cmu.survey.jsp
Class WebappShutdownListener
java.lang.Object
cmu.survey.jsp.WebappShutdownListener
- All Implemented Interfaces:
- java.util.EventListener, javax.servlet.ServletContextListener
public class WebappShutdownListener
- extends java.lang.Object
- implements javax.servlet.ServletContextListener
Do stuff at a webapp's shutdown.
Since this can't be invoked directly at startup time, we have to do a roundabout registration technique -- webapps can register a shutdown listener (which is an ActionListener) that will get called at shutdown time, via this class, since we can't register a shutdown listener directly to the JSP Servlet Engine.
It took me so long to find this interface and how to use it in web.xml, found eventually at:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg147108.html
Field Summary |
static java.util.Vector<java.awt.event.ActionListener> |
shutdownListeners
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
shutdownListeners
public static java.util.Vector<java.awt.event.ActionListener> shutdownListeners
WebappShutdownListener
public WebappShutdownListener()
addShutdownListener
public static void addShutdownListener(java.awt.event.ActionListener actionListener)
removeShutdownListener
public static boolean removeShutdownListener(java.awt.event.ActionListener actionListener)
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent arg0)
- Specified by:
contextDestroyed
in interface javax.servlet.ServletContextListener
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent arg0)
- Specified by:
contextInitialized
in interface javax.servlet.ServletContextListener