1 package org.javabb.infra; 2 3 import java.util.Iterator ; 4 import java.util.Map ; 5 6 import javax.servlet.ServletContextEvent ; 7 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 11 import com.opensymphony.clickstream.Clickstream; 12 import com.opensymphony.clickstream.ClickstreamListener; 13 14 21 public class CustomClickstreamListener extends ClickstreamListener { 22 private final Log log = LogFactory.getLog(getClass()); 23 24 28 public void contextDestroyed(ServletContextEvent evt) { 29 Map clickstreams = (Map ) evt.getServletContext().getAttribute(CLICKSTREAMS_ATTRIBUTE_KEY); 30 31 if(clickstreams == null) { 32 33 return; 34 35 } 36 37 Iterator it = clickstreams.keySet().iterator(); 39 while (it.hasNext()) { 40 String key = (String ) it.next(); 41 Clickstream stream = (Clickstream) clickstreams.get(key); 42 43 if (log.isDebugEnabled()) { 44 log.debug("Invalidating session: " + key); 45 } 46 47 stream.getSession().invalidate(); 48 clickstreams.remove(key); 49 } 50 51 super.contextDestroyed(evt); 52 } 53 } | Popular Tags |