Вопрос

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.

Это было полезно?

Решение

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  
 }  

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top