File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSessionBindingListener vs HttpSessionListener

 
Garlapati Ravi
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am bangging my head to understand these two stuffs:

which of theese interfaces(HttpSessionBindingListener & HttpSessionListener) and their methods will be called in the above two cases.

All these days i was under impression that valueUnbound() of HttpSessionListener will get invoked in any of the above two cases.

But in API these two cases was covered for HttpSessionBindingListener interface as well. This really confusing me.

Please clarify, which method of interface would be called in above 2 cases.

Regards,
Ravi
 
Gorkal Raghavendra
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Garla Ravi:
Hi All,

I am bangging my head to understand these two stuffs:

which of theese interfaces(HttpSessionBindingListener & HttpSessionListener) and their methods will be called in the above two cases.

All these days i was under impression that valueUnbound() of HttpSessionListener will get invoked in any of the above two cases.

But in API these two cases was covered for HttpSessionBindingListener interface as well. This really confusing me.

Please clarify, which method of interface would be called in above 2 cases.

Regards,
Ravi



for session invalidated,your class will implements the HttpSessionBindingListener and will call the valueUnbound(HttpSessionBindingEvent eve).
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpSessionBindingListener has got two methods valueBound() and valueUnbound().
This interface is implemented by an object that's an attribute. So that every time an instance of this object is Add/Removed to/from a session valueBound()/valueUnbound() will be called.

HttpSessionListener has two methods sessionCreated() and sessionDestroyed() and this interface is implemented by any class (doesn't have to be an attribute, but it can) and it will be called when a session is created or a session is destroyed.

so when a session is destroyed/invalidated/timedout etc the method HttpSessionListener.sessionDestroyed() will be called on a class that implements HttpSessionListener. Also if there is an object that has been added to the session and at the same time it implements HttpSessionBindingListener then valueUnbound() will be called.
 
Garlapati Ravi
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Musab.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic