Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

IPC - AJAX vs JSR 286 Events

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashish,

What is your opinion on using AJAX events vs JSR 286 Events for Inter-Portlet Communication.

Playing with both, I do like the way AJAX event handling enables you to limit the size of requests to the server... but then again if you use JSR 286 Events, you don't have to write so much javascript... (which is painful IMO)

On a related topic.... does making requests to the serveResource method refresh the session? Because I remember that JSR 168 didn't have an AJAX proxy and instead I've used a servlet... which doesn't refresh the session... so even though the user is clicking away, at some point the session will expire if they don't make a full request back to the server.

Thanks,
Eric
 
author
Posts: 469
20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Inter-portlet communication using AJAX can get quite messy sometimes. Event-based inter-portlet communication is quite sophisticated, giving you the opportunity to send Java objects to the portlet(s) registered to receive the event. The benefit of using event-based IPC is that the receiver portlet can perform an operation in response to the received event. For instance, chapter 11 shows an example scenario in which there are 2 portlets - Book Catalog and Recently Added Book. When a user enters a new book to the catalog, an event is generated for which Recently Added Book portlet has registered interest. The event payload contains the Book object, representing the newly added book. The Recently Added Book portlet extracts Book object from the event and makes use of it update its content. Also, its easy to add new receiver portlets to your portal without modifying the event-sender portlet.

The ResourceServingPortlet interface is part of Portlet 2.0 API; therefore, you don't need to worry about session sync issues or timeouts.

regards
ashish
 
reply
    Bookmark Topic Watch Topic
  • New Topic