Ajax polling session timeout in Spring web application

I am developing a web application based on Spring 3.0 that requires all users to log in to view data. After logging in, some parts of the screen use the AJAX polling mechanism to update the contents of the screen in the background. At present, our session will not be a timeout because every ajax request to the server updates the timeout of the web application and the session never expires.

I need to change the application so that when the user logs on to the system, the controller responds to the data poll, but does not update the session timeout, so the session time ends at the appointed time. If the user does not have an active session, the controller returns nothing.

How should I do it?

+3
source share
2 answers

How to use the use of <% @page session = "false"%> for pages that provide ajax data. Because these pages are not session bound, the session timeout may not be updated.

0
source

You will need to trick the inside of the servlet container.

Here is what i will do

  • Search google for “xhr XmlHttpRequest access to servlet session in container” and see if something interesting appears (I'm too lazy to do it right now).
  • , , . , , , javax.servlet.http.HttpSession.getLastAccessedTime. , , , . , Tomcat, , XML.
-1

All Articles