• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Server Session Timeout

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Im working with JSP's in WSAD 5.0. The server session timout for my application has been set through the administration console. I was suppose to dsiplay an popup with message "Your session is about to expire" 2 min prior to the session expires and then as the session expires the message changes to "Your sessin has expired" to achieve this i used setInterval()method with interval as 30 min and setTimeout() methods of java in javascripts.Now comes the problem, as the second message is displayed and after i close the message pop up n then access ne other screen the session does not expire and allowes me to access other pages.
Does the setInterval() method that works in background stops the session from expiring even if there is no data sent or received from the server.
And is there ne way i can get the set server timeout into my application at runtime to set the interval in my setInterval() method.
Please help.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. You can override the default session lifetime with the HttpSession method:
setMaxInactiveInterval( int seconds )

2. You can then use the seconds value when writing Javascript into HTML pages to roughly synchronize the browser with the server.

3. ANY request to the server will cause the session timeout mechanism to reset and start counting down seconds again.

Bill
 
Kaustubh Hande
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that reply.

But my problem is that we have varios server at onsite where the application is being run and the session timeout for them is different according to the need, thus i cannot hardcode or set the session timeout value in my application. It would be a great favour if i can get to know how i can get the set server session timeout for a perticular server.
Please help

Thanks
Kaustubh
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It would be a great favour if i can get to know how i can get the set server session timeout for a perticular server.


Why not read it from web.xml as an init-param for an individual servlet or as a session-config parameter for the whole web app?

In the default web.xml for tomcat I find this entry:

after the last servlet-mapping element. Seems to me you should be able to override that default on a web app by web app basis.

Bill
 
Get off me! Here, read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic