Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

checking valid session id  RSS feed

 
Jim Smith
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I store some session id in a databasse and later would like to know if each of them is still valid, what should I do?
Thank you for your help.
Jim.
 
Benny Tang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In order obtain the id of the session, you can user the getId() method in the class javax.servlet.http.HttpSession. Hope this can help you.
Benny
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution is to to attach a session listener to your application to make sure that the details in the database are removed when the session expires on the server. ie when the session expires, the session ID is no longer valid.
Personally I don't like attaching functionality like this to the session, it starts to get a bit wierd and can interfere with the resposibilities of the Session Manager. Other solutions are to make sessions persistent (if the app server supports this), or attach the data to the user and not a single login instance.
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!