« Return to Thread: Sharing session between portlet and servlet

RE: Sharing session between portlet and servlet

by JAMES Nightly Build System :: Rate this Message:

Reply to Author | View in Thread

Eric wrote:

> Portlets and Servlets in the same webapp can share session attributes
> placed in the session by the portlet in the APPLICATION_SCOPE.  There
> is no provision in the portlet API for sharing session attributes
> between webapps.

Nor should there be, unless/until the Servlet Specification decides to
take it up, and resolve the issues.

> Michael wrote:
> > I also tried to use the overloaded method of setAttribute [with]
> > PortletSession.APPLICATION_SCOPE) [and] PortletSession.PORTLET_SCOPE)
> > without success.

Sorry, you have been bitten by the atrociously ill-chosen naming of the
manifest constants.  APPLICATION_SCOPDE means "don't encode my keys and
show me all keys" and "PORTLET_SCOPE" means "encode my keys, and only show
me keys encoded with my unique id."  It has nothing to do with any real
scope, being specific as it is to the Servlet Session scope.

You can communicate between applications using Portlet Messaging.  Event
handling portlets in each webapp can place values into their respective
servlet sessions using APPLICATION_SCOPE (unencoded keys), making them
available to collocated servlets.

        --- Noel


smime.p7s (3K) Download Attachment

 « Return to Thread: Sharing session between portlet and servlet