There are 7 Listeners that are important for servlet and session
1 . ServletContextListener
public void contextDestroyed(ServletContextEvent arg0) {}
public void contextInitialized(ServletContextEvent arg0) {}
2. SessionListener / HttpSessionListener
sessionCreated(HttpSessionEvent evt ){}
sessionDestroyed(HttpSessionEvent evt) {}
HttpSessionActivationListener
sessionDidActivate(HttpSessionEvent ) {}
sessionWillPassivate(HttpSessionEvent ) {}
sessionDidActivate(HttpSessionEvent ) {}
sessionWillPassivate(HttpSessionEvent ) {}
3. ServletContextAttributeListener / HttpSessionAttributeListener / ServletRequestAttributeListener
attributeAdded()
attributeRemoved()
attributeReplaced()
in attributelistener the argument to the methods will be different as per the interface.
for HttpSessionAttributeListener arg will be HttpSessionSessionBindingEvent.
4. HttpSessionBindingListener will be implemented by attribute
valuebound(HttpSessionBindingListener )
valueunbound(HttpSessionBindingListener )
No comments:
Post a Comment