Dashboard > LAMS 2 > ... > Core Services > LAMS shared session
  LAMS 2 Log In | Sign Up   View a printable version of the current page.  
  LAMS shared session
Added by Dapeng Ni , last edited by Dapeng Ni on Sep 27, 2005  (view change)
Labels: 
(None)

LAMS constructs by many web applications. In order to sharing information among them, LAMS provides a mechanism to simulate HttpSession but across multiple web applications environment.

How to use LAMS shared session

Initialize system environment

The simple way to do this is run "copyfiles" target in LAMS_build ant script. This target will copy corresponding configuration files:

  1. Copy jboss-service.xml to ${JBoss}/server/default/conf folder.
  2. Copy context.xml to ${JBoss}/server/default/jbossweb-tomcat55.sar folder.
  3. Copy lams-session.jar to ${JBoss}/server/default/lib folder.

Add filter in your web.xml file

<filter>
       <filter-name>SystemSessionFilter</filter-name>
         <filter-class>
		   org.lamsfoundation.lams.web.session.SystemSessionFilter
         </filter-class>
</filter>
<filter-mapping>
    <filter-name>SystemSessionFilter</filter-name>
     <url-pattern>/*</url-pattern>
</filter-mapping>

Get shared session instance:

import org.lamsfoundation.lams.web.session.SessionManager;
...
HttpSession ss = SessionManager.getSession();
UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER);
...

SessionManager returns a HttpSession instance. You can use it like a true HttpSession except:

  1. Its values are shared across all web applications.
  2. HttpSession.isNew() method is invalidate.
  3. HttpSession.getServletContext() method is invalidate.

Limitation

  • This solution relies on Cookies, so client browser must support cookies.
  • Currently, all web applications which need use this solution must be deployed in one JVM.

Powered by a free Atlassian Confluence Open Source Project License granted to Learning Activity Management System (LAMS). Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators