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.

Était-ce utile?

La 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  
 }  

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top