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.
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 ??
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.
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.
Joined: Nov 20, 2000
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.
Joined: Aug 09, 2005
In that case (where the other portlets get their content), there will be a page refresh . right ?
Joined: Nov 20, 2000
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.