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 Servlets and the fly likes HttpSessionListener if browser is closed 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 » Java » Servlets
Bookmark "HttpSessionListener if browser is closed" Watch "HttpSessionListener if browser is closed" New topic
Author

HttpSessionListener if browser is closed

Arshad Azeem
Greenhorn

Joined: Aug 21, 2005
Posts: 13
Hi,

Is the sessionDestroyed(HttpSessionEvent event) method in our implementation of HttpSessionListener supposed to be called if the browser is closed? I think it shouldn't be and will not be, but can anyone please confirm?

Thanks,
Arshad.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
It is supposed to be called if the session is destroyed.

The session will be destroyed when HttpSession#invalidate() is called, either manually by coding or "automatically" by the webcontainer when the session is timed out.
Arshad Azeem
Greenhorn

Joined: Aug 21, 2005
Posts: 13
question is...doesn't the session end when the browser is closed
Sunil Vasudevan
Ranch Hand

Joined: Mar 05, 2007
Posts: 107
Server does not know about user closing the browser. So the session won't end. The session will still be active on the server till the session times out.


Sunil.V<br />SCJP2, SCWCD1.4, SCBCD1.3
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Arshad Azeem wrote:question is...doesn't the session end when the browser is closed
Stuff doesn't work that way, no.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSessionListener if browser is closed
 
Similar Threads
how to disable close window
Update database for logout when signout is not done properly
how to access current Application in a single Container
Listener to detect when session ends
Delete folder on window close