• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Browser close session destroy

 
pradeep gamage
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been working login handle by jsf,Spring and hibernate. I have created a login. but when i close the web browser user session still exist in web server. so that user can't log again until 30 min.
I have added following code part in web.xml



So what i want to do is that when user close browser or restart computer invalidate (User log session)the session in server side and allow that user to logging again. Please give me idea how to do my requirement?
thanks in advance
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way using server-side code to force the client to make one last server request when a browser is closed. And, in any event, there are too many ways for such a process to fail, starting with a simple browser crash and moving on up from there. For one thing, it takes more than closing a window to shutdown a browser.

Unless something really strange is going on, your sessionid cookie should have been destroyed when the final browser window closed, however. That would mean that even though the session object still existed and still held resources, the user wouldn't be requesting that session when restarting the browser and a whole new session would have to be built. When using the J2EE standard container-managed security system that would be sufficient to force the user to log in again.

So, presumably you're using a Do-It-Yourself login system. As I've said many times before, DIY systems are buggy, expensive, and insecure and should be avoided.

And, if by chance, you're manually meddling with the jsessionid appendage to the URL, I think that would explain why you're not discarding the old session when you should be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic