Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Session Tracking

 
Saravanan V
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want a user to be authenticated only once.So i create a session and set a flag when he logs in.The next time when he login a message is thrown.I invalidate the session and reset the flag when he logs out.I have set a max inactive interval for the session to be 10 mins.Now here is the probs.I want to reset the flag when the session expires.How this can be done.Help in this.
Wishes
Saravanan.V
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't mention where that flag is being set. But it may be useful to know that if you create a session-scoped JavaBean that implements HttpSessionBindingListener, its valueUnbound() method gets called when the session expires. That should give you the hook you need to do whatever needs doing.
- Peter
[This message has been edited by Peter den Haan (edited November 12, 2001).]
 
Saravanan V
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter
Thanx for Ur Reply.Anyway i set the flag in the database.
I used a class that implements the HttpSessionBindingListener interface and the valueBound() method and valueUnbound() seems to be called when u bind the object to the class(by session.putValue()) and unbind the object(by session.removeValue()).This is where the problem is.When logout i am removing the value which unsets the flag in database..but thatz the not the case when session expires as i dont call removeValue().Hope the problem is more clearer now..
Wishes
Saravanan.V
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic