-
1. Re: How to share session data between portlets
guybedo Jul 10, 2009 8:44 PM (in response to guybedo)oki managed to share data across the portlets by getting the portalRuntimContex with Navigation.getPortalRuntimeContext() and then the portal session.
BUT this does not work with richfaces a4j requests ....
those requests are directly targeted to the webapp and do not go through the portal servlet, so there is no "portal" data in the request, context, session ...
I wondered if i could access a portal MBean in which i could get access to the current sessions but i have no idea if there is such a MBean ...
could someone give me some help ?
thanks. -
2. Re: How to share session data between portlets
vineet_tripathi Jul 27, 2009 2:42 AM (in response to guybedo)Insted of using portletSession, you can use HttpSession object to store such information, try this code snippet:
import javax.security.jacc.PolicyContext; import javax.security.jacc.PolicyContextException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); request = (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest"); HttpSession httpSession = request.getSession();
-
3. Re: How to share session data between portlets
natoine Oct 26, 2010 10:26 AM (in response to vineet_tripathi)Isn't there a way to share attributes between portlets not in a same Application ?
Isn't it possible to use the <shared-session-attribute> element in portlet.xml to share attributes through session between portlet not of a same application ?
I have tried to set this element to true or to the attribute name but i'm not able to see attributes from a portlet to another.
-
4. Re: How to share session data between portlets
natoine Oct 27, 2010 9:38 AM (in response to vineet_tripathi)I have tried your code in JBoss portal 2.7.2 and i got an error :
java.lang.IllegalArgumentException: unknown handler key
at javax.security.jacc.PolicyContext.getContext(PolicyContext.java:280)
Well JBoss 2.7.2 implements JSR 286 so i should be able to use the shared-session-attribute but it doesn't work better... -
5. Re: How to share session data between portlets
theute Oct 27, 2010 9:50 AM (in response to natoine)There is no such thing as "shared-session-attribute" in the JSR-286
-
6. Re: How to share session data between portlets
natoine Oct 27, 2010 10:54 AM (in response to theute)Yeah you're right it's just an enhancement of JSR 286.
I thought it was in the final version of the JSR...
Sorry about that.
-
7. Re: How to share session data between portlets
adnanqureshi Dec 13, 2010 4:42 PM (in response to natoine)Can anyone suggest any solution/workaround for sharing data across different pages?