• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSesssionListener not called when cookies are cleared

 
Shaik Muhammad
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My application uses am implementor of HttpSessionListener to remove the HttpSession instance that is stored in a map when that session is invalidated. My problem is , after logging into the application, when i manually clear the cookies in my browser, this listener class is not called . How to get my application notified when cookies are cleared in the interim. Please help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't happen. How is the server going to be notified when you clear the cookies in the browser?

Besides, clearing the cookie does not invalidate the session. Rather, you've "orphaned" the session and it will eventually time out.
 
John Kimball
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless I'm missing something...

Your listener doesn't fire because clearing cookies doesn't send an event to the server (and nor should it).

Think of it this way: Say I have multiple session cookies to multiple servers (say, a 1000 of them) and the browser persists those cookies even if the server tells it NOT to.

Now suppose I close all browsers and open a new browser with a blank page and I clear the cookies. Should the browser contact EVERY single server?

I think that would be a nightmare!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic