This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Httpsession and user session timeout tracking.

 
isodbaar yes isodbaar
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I am trying to monitor user session and alert user that the session is about to expire. I do have client side solutions however I am wondering how can I inquire the Httpsession.getLastAccessedTime() (or similar ) method without renewing user session stats. In essence every time I access this method through servlet or jsp, the session is automatically extended and this, obviously, defeats the purpose of the session timeout tracking.

Thank you in advance for your help.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you have already realized, you can't do it with the built-in session timeout mechanism.

Therefore you will need to write a separate mechanism which only resets your custom timeout counter when the user accesses one of your custom application functions.

See the java.lang.System.currentTimeMillis method to get a timestamp.

Bill
 
Paul Clapham
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing on the server side can do this, since the server side only communicates with the user when the user sends a request. And since you want to communicate with the user without receiving a request, you have to look at client-side solutions.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic