This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XMLPortletRequest

 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case (where the other portlets get their content), there will be a page refresh . right ?
 
Ashish Sarin
author
Ranch Hand
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic