GeeCON Prague 2014*
The moose likes Servlets and the fly likes Session Timeout Timer Reset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Session Timeout Timer Reset" Watch "Session Timeout Timer Reset" New topic
Author

Session Timeout Timer Reset

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

hi,

I want to reset my session timeout time back to 20 minutes each time the user sends a new request, 'm using struts 2.0, i have defined session timeout in web.xml as 20 minutes, so whatever the user does, he is logged out after 20 minutes, i have also set maxInactiveInterval as 20 minutes in the session listener, still its not taking the last accessed time but taking the session creation time and application times out after 20 minutes. what to do ?? THANKS IN ADVANCE FOR HELP. !!

i am using Geronimo 2.0 server.
[ September 10, 2008: Message edited by: Robin John ]

Time is what we want the most, but what we use the worst. -- William Penn
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
still its not taking the last accessed time but taking the session creation time and application times out after 20 minutes.


The servlet container WILL reset the session life countdown every time there is a request to the application having that session ID.

Why do you think it is not working?

Bill
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

no it times out abrubtly after 20 minutes, no matter what happens to the application
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

this is my code in web.xml

<listener>
<listener-class>
com.web.helper.WirSessionListener
</listener-class>
</listener>

<session-config>
<session-timeout>20</session-timeout>
</session-config>
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
If your servlet container is not reseting the last accessed time every time a request comes in then it is not implementing the servlet API correctly. Geronimo 2.0 claims to be "fully certified Java EE 5 application server runtime."

Since this is a function that practically every complex servlet application depends on working correctly, it seems reasonable to me that something else is going on to invalidate your sessions. If it really is Geronimo's fault, you have discovered a serious bug.

Bill
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

thanks bill for the replies..., can you please tell me what all are needed to be done for implementing session timeout under the below scenario, it would be really helpful.

Requirement: If the user is idle for more than or equal to 20 minutes log him out.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

All you do (as William has said) is set the session-timeout. The servlet container will do the rest. If it is not I'd send your test case to the Geronimo people. But I would be surprised if it were Geronimo's fault - this is a fairly key requirement of Servlet containers.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
in Mkumar
Greenhorn

Joined: Sep 08, 2008
Posts: 20
Yes ! My answer will be the same as Pauls's statement. - Manoj
Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

yup guys thanks so much !! the problem is resolved actually i was creating new request each time i got it from the client

it was a silly mistake from my side. was doing a getSession(true);

in the code and was not passing the session from one application to another so the reset was happening in one application but the user was in the other with a different session.

silly me..
thanks for your support...
 
GeeCON Prague 2014
 
subject: Session Timeout Timer Reset