• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IPC - AJAX vs JSR 286 Events

 
E Cho
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Ashish Sarin
author
Ranch Hand
Pie
Posts: 444
10
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic