aspose file tools*
The moose likes Portals and Portlets and the fly likes XMLPortletRequest Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "XMLPortletRequest" Watch "XMLPortletRequest" New topic
Author

XMLPortletRequest

Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
Can someone please help me in understanding XMLPortletRequest.
I have used ajax in portlets prior to JSR286, using shared session. And I came to know that it is even simpler to use Ajax in Portlet2.0 with the help of serveResource method. As it serves only the content , not the entire portal page markup.

I read in some blogs that there is an XMLPortletRequest javascript which is a wrapper around XMLHttpRequest. But I need some help in understanding why we need this wrapper. What are the issues if we use XMLHttpRequest directly. What is the benifit of this wrapper.

Also, I found that this is not available in many contianers out of the box. I copied it from Pluto portal and used in portlet which I deployed in Liferay.
So, Is this wrapper also part of JSR286 spec ??
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
XMLPortletRequest is meant for invoking render and action methods of the portlet using AJAX. If you are using XMLPortletRequest to invoke serveResource method, that there is no benefit as such.

Typically portal servers generate the complete portal page in response to action/render methods. A portal server may choose to implement XMLPortletRequest so that the server returns only the HTML fragment(s) for the portlets whose state has changed in response to invocation of render/action method.
XMPortletRequest is not part of JSR 286.

regards
ashish


Author of
Getting started with Spring Framework
Portlets in Action
Spring Roo 1.1 Cookbook
Portlets blogSpring Roo blog
Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61

Thanks Ashish for the reply.
A portal server may choose to implement XMLPortletRequest so that the server returns only the HTML fragment(s) for the portlets whose state has changed in response to invocation of render/action method.

I am bit confused here.
Does it mean, the ajax response can be from more than one portlet , even though the request is targeted to one particular portlet? How the response will be handled in the original portlet which triggered to request ? How it differentiate between the response targeted to it and other portlets ?

May be I have to put my hands in some POC to get clear idea in this.
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
The AJAX response will be for one portlet, but the portal server may also update the content of other portlets if the initial AJAX request resulted in change in content of other portlets. For instance, if an AJAX action request is sent to a portlet, then it may fire events. When the event is processed by the receiver portlets, it would be required for the portal server to re-render the content of the receiver portlets.
Reddy Prashanth
Ranch Hand

Joined: Aug 09, 2005
Posts: 61
In that case (where the other portlets get their content), there will be a page refresh . right ?
Ashish Sarin
author
Ranch Hand

Joined: Nov 20, 2000
Posts: 432
    
    5
No. Thats the whole idea of XMLPortletRequest. The portal server should be able to automatically handle partial page refresh for other portlets on its own.

I haven't come across any implementation of XMLPortletRequest which really does it. I know that it was part of IBM WebSphere Portal but never tried it myself.

regards
ashish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XMLPortletRequest