• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XMLPortletRequest

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ??
 
author
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic