5 Replies Latest reply on May 9, 2008 7:25 PM by Gautam Wadhwani

    SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEPARAT

    ram sundaram Newbie

      i have this situation where i need to share the session between the two portlets which are deployed as two different war files.

      i tried putting the values in the APPLICATION_SCOPE but it is returning null when i try to retrieve the data from session in the other portlet.

      Any ideas regarding this ?

        • 1. Re: SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEP
          Chris Laprun Master

          Yes. The specification is quite clear about this: sharing session data only works between portlets deployed in the same web application (war file).

          • 2. Re: SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEP
            ram sundaram Newbie

            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?

            thanks again.

            • 3. Re: SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEP
              Chris Laprun Master

              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.
              You could:
              * 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.

              • 4. Re: SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEP
                ram sundaram Newbie

                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 ?

                • 5. Re: SHARING THE SESSION BETWEEN THE PORTLETS DEPLOYED AS SEP
                  Gautam Wadhwani Newbie

                  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.