my dog learned polymorphism*
The moose likes Portals and Portlets and the fly likes IPC - AJAX vs JSR 286 Events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "IPC - AJAX vs JSR 286 Events" Watch "IPC - AJAX vs JSR 286 Events" New topic
Author

IPC - AJAX vs JSR 286 Events

E Cho
Greenhorn

Joined: Apr 24, 2009
Posts: 9
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

Joined: Nov 20, 2000
Posts: 432
    
    5
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


Author of
Getting started with Spring Framework
Portlets in Action
Spring Roo 1.1 Cookbook
Portlets blogSpring Roo blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IPC - AJAX vs JSR 286 Events