Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSessionListener if browser is closed

 
Arshad Azeem
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.
 
Bauke Scholtz
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
 
Sunil Vasudevan
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic