1 package org.exoplatform.jcr.launcher; 2 3 import javax.servlet.ServletContext ; 4 import javax.servlet.http.HttpSession ; 5 import javax.servlet.http.HttpSessionEvent ; 6 7 import org.exoplatform.container.PortalContainer; 8 import org.exoplatform.container.RootContainer; 9 import org.exoplatform.container.SessionContainer; 10 11 public class SessionListener { 12 13 public void sessionCreated(HttpSessionEvent event) { 14 } 15 16 public void sessionDestroyed(HttpSessionEvent event) { 17 HttpSession session = event.getSession() ; 18 ServletContext context = session.getServletContext() ; 19 PortalContainer pcontainer = 20 RootContainer.getInstance().getPortalContainer(context.getServletContextName()) ; 21 SessionContainer scontainer = (SessionContainer)pcontainer.getComponentInstance(session.getId()) ; 22 if(scontainer != null) { 23 PortalContainer.setInstance(pcontainer) ; 24 pcontainer.unregisterComponent(session.getId()) ; 25 scontainer.stop() ; 26 PortalContainer.setInstance(null) ; 27 } 28 } 29 30 } 31 | Popular Tags |