This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HttpSessionBindingListener vs HttpSessionListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HttpSessionBindingListener vs HttpSessionListener" Watch "HttpSessionBindingListener vs HttpSessionListener" New topic
Author

HttpSessionBindingListener vs HttpSessionListener

Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 168
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


Ravi Kumar
SCWCD 5 - 89%, SCJP 1.4 - 90%
Gorkal Raghavendra
Ranch Hand

Joined: May 21, 2008
Posts: 30
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

Joined: Aug 06, 2007
Posts: 231
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.


SCBCD - SCWCD - SCJD - SCJP - OCA
Garlapati Ravi
Ranch Hand

Joined: Mar 05, 2008
Posts: 168
Thank You Musab.
 
wood burning stoves
 
subject: HttpSessionBindingListener vs HttpSessionListener
 
Similar Threads
Session doubts
declaration of Listener
Info: Sequence of session listeners invocation
listener interfaces ..
Question on HttpSessionBindingListener