File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Timeout Timer Reset

 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no it times out abrubtly after 20 minutes, no matter what happens to the application
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13048
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
in Mkumar
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes ! My answer will be the same as Pauls's statement. - Manoj
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic