Yes. The specification is quite clear about this: sharing session data only works between portlets deployed in the same web application (war file).
thanks for the immediate reply to the post. do u think is there any work around for this scenario? Does any tweak in the configuration help me in this regards?
There is no work-around to share session data between separate web apps. This is more a limitation of how web applications work than portlets.
* bundle the portlets in the same web application
* try to avoid sharing data altogether
* use inter-portlet communication with portlet 1.0 (proprietary to portal providers)
* use public shared render parameters and/or events with portlet 2.0. This is not yet available in JBoss Portal but will be in 2.7. Portlet 2.0 is implemented in JBoss Portlet Container 2.0, currently in beta but this is not a complete portal solution.
Thanks again , my situation is i wanted all the portlets in separate war files to know the currently logged in user and his associated roles. iam authenticating against LDAP and also getting details from LDAP.
so how i can make all the portlets to get this details? Does individual Portlets should handle this?
so when multiple user logs will this be a show stopper ?
Here is what we have done to share data across different war files deployed on JBOSS portal.
There is one interesting thing that happens in Jboss Portal, i.e that it gives the same session ID to all the session objects created in different war files if request comes from the same client.
What it means is that we can create an external data holder which is accessible to all the war files deployed in portal and save and retrieve data from it using the session id.
Here is how it works:
1. Create a singleton class which is accessible to all the war files, keep it at shared class path .. i.e in /server/default/lib.
2. When a user logs in, we can save data that is to be shared in this singleton class against the session ID.
3. When a user visits pages from other war file, access the saved data from the singleton class by querying against the session ID of this war file.
4. Apply a session listener in portal-server.war file which cleans the data from singleton when a user logs out.
Only issue with this approach is that while doing session replication the data from the singleton will not shared across JVMs.