Question

I am talking about pure servlet application (assuming no framework is used). Which Servlet Listener does not need to be configured in web.xml? and why? Thanks.

Was it helpful?

Solution

HttpSessionBindingListener are not registered in the DD.. It just happens automatically.. The HttpSession object should take care of this itself.. The HttpSession implementation should work something like the following:

public void SetAttribute( String name, Object value ) {  
   if( value instanceof HttpSessionBindingListener ) {  
   // Build HttpSessionBindingEvent  
   value.valueBound( event );  
 }  

  // Do the rest  
 }  

OTHER TIPS

The listener HttpSessionActivationListener is not needed to be configured in web.xml. Although I do not know the exact reason why it need not be configured, I think it deals with session activation and passive events when the session is being migrated from one JVM to another JVM.

You can refer javadoc for HttpSessionActivationListener

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top