KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > bin > JahiaWebAppListener


1 package org.jahia.bin;
2
3 import javax.servlet.http.HttpSessionEvent JavaDoc;
4 import javax.servlet.http.HttpSessionListener JavaDoc;
5
6 import org.jahia.registries.ServicesRegistry;
7 import org.jahia.services.applications.JahiaApplicationsDispatchingService;
8 import org.jahia.services.sitemap.JahiaSiteMapService;
9
10 /**
11  * This class is used to implements listeners to the servlet containers events.
12  *
13  * <p>Copyright: Copyright (c) 2002</p>
14  * <p>Company: Jahia Inc.</p>
15  * @author Serge Huber
16  * @version 3.0
17  */

18
19 public class JahiaWebAppListener implements HttpSessionListener JavaDoc {
20
21     private static org.apache.log4j.Logger logger =
22         org.apache.log4j.Logger.getLogger(JahiaWebAppListener.class);
23
24     public JahiaWebAppListener() {
25     }
26
27     /**
28      * Notification that a session was created.
29      * @param se the notification event
30      */

31     public void sessionCreated(HttpSessionEvent JavaDoc se) {
32         logger.debug("Session " + se.getSession().getId() +
33                              " was just created...");
34     }
35
36     /**
37      * Notification that a session was destroyed.
38      * @param se the notification event
39      */

40     public void sessionDestroyed(HttpSessionEvent JavaDoc 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