1 package org.jahia.bin; 2 3 import javax.servlet.http.HttpSessionEvent ; 4 import javax.servlet.http.HttpSessionListener ; 5 6 import org.jahia.registries.ServicesRegistry; 7 import org.jahia.services.applications.JahiaApplicationsDispatchingService; 8 import org.jahia.services.sitemap.JahiaSiteMapService; 9 10 18 19 public class JahiaWebAppListener implements HttpSessionListener { 20 21 private static org.apache.log4j.Logger logger = 22 org.apache.log4j.Logger.getLogger(JahiaWebAppListener.class); 23 24 public JahiaWebAppListener() { 25 } 26 27 31 public void sessionCreated(HttpSessionEvent se) { 32 logger.debug("Session " + se.getSession().getId() + 33 " was just created..."); 34 } 35 36 40 public void sessionDestroyed(HttpSessionEvent se) { 41 logger.debug("Session " + se.getSession().getId() + 42 " was just destroyed... purging session related data... "); 43 ServicesRegistry servReg = ServicesRegistry.getInstance(); 44 if (servReg != null) { 45 JahiaApplicationsDispatchingService dispatchingService = servReg.getJahiaApplicationsDispatchingService(); 46 if (dispatchingService != null) { 47 dispatchingService.flushAllSessionsCaches(se.getSession()); 48 } 49 JahiaSiteMapService siteMapService = servReg.getJahiaSiteMapService(); 50 if (siteMapService != null) { 51 siteMapService.removeSessionSiteMap(se.getSession().getId()); 52 } 53 } 54 } 55 } 56 | Popular Tags |