• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

HttpSessionListener if browser is closed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
question is...doesn't the session end when the browser is closed
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Arshad Azeem wrote:question is...doesn't the session end when the browser is closed

Stuff doesn't work that way, no.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic