Forums de discussion

Session sharing : no share between two public portlets

thumbnail
leo p, modifié il y a 13 années.

Session sharing : no share between two public portlets

Expert Publications: 363 Date d'inscription: 06/07/10 Publications récentes
Hello,

I'm trying to share attributes through PortletSession between Portlet A and Portlet B.

Here is my portlets configuration :
portlet A: <private-session-attributes>true</private-session-attributes>
portlet B: <private-session-attributes>false</private-session-attributes>

I use servlets in the portlet A (with JSF Listener) so I can't set this property to false. I have found a solution with a third portlet, which would be on the same WAR as the Portlet A (called Portlet A-bis).
portlet A-bis: <private-session-attributes>false</private-session-attributes>

Now, I can share sessions from this portlet with my Portlet B. My Portlet A share a static user-session map with Portlet A-bis. Everything is OK until I try to share the attribute from portlet A-bis with portlet B : the value is null for the attribute on portlet B, but I can see the attribute name on the portlet session.

I though that the fact that I use two portlets with different value for the "private-session-attributes" was the problem. So, I set all the "private-session-attributes" (for A, A-bis, B ) to false and I try again. But the result is the same : I can see the attribute name on the portlet session but the value is always null.

Is this behaviour normal ? Is it possible to use PortletSession through different portlets when one of the sharing-portlet cohabits with an other portlet in the same WAR ?

Thx.


[edit] Hm... well... it seems I did a mistake with the value key... what a shame...
The solution I describe with "portlet A-bis" work perfectly. I found similar architecture on this very interesting blog post : http://longgoldenears.blogspot.com/2008/03/liferay-session-sharing-demystified.html ... I hope it cans help other people.