I am dealing with a JSP-Web-Application and get troubles in the moment the session expires. As placed in the web.xml the timeout is defined after 30 Minutes. But I want to keep the session alive during the time the user just keeps the window opened. I thought first about a simple AJAX-Component that says "hello" to the Server every 10 Minutes and maybe shoots a simple Test-Statement to the database (e.g. "Select 1").
But two things make me suspicious about this:
- If I'd put a simple
setTimeout(sayHi(),600)
in a endless while-JS-loop is this effective and a wise decision? - Is even the concept of this a good idea?
All the users of the system share a common pooled BoneCP connection to the database to execute short queries from the database. Also several data rows are fetched via Hibernate. The Hibernate-part is the most error-prone part of the whole application, after the timeout, those sets need to be reloaded as well. Is there a way to keep the Hibernate-Session alive as well?
Thank you for your help!