Hi, I know that you can set in the web.xml the session time-out. However, it refers to idle-time. Is there a way to set the session to be a set amount of time, for example give someone10 min to answer a quiz? Thanks, RK
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
You would have to implement that in your own code - create an initial timestamp, etc. stored in the session - you could then have an independent timing thread that would control a separate collection of references to the session objects. When the time was up you could invalidate the session. Bill
Thanks, I just compared the session time to the current time and it produced the required results. RK
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
The HttpSession class also offers the method setMaxInactiveInterval(int seconds), so that the server automatically invalidates the session when it times out.
"Aussie Developer", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp. We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements. Thanks. Dave ps: which coast you on?
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
Hi Dave My apologies, re Aussie Developer. Anyway, I live and work on the East Coast - Brisbane. cheers Gav ...