Announcement Announcement Module
Collapse
No announcement yet.
HttpSession timeout does not happen because of continuos periodical ajax calls Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HttpSession timeout does not happen because of continuos periodical ajax calls

    We are using short polling in Jquery to periodically send ajax requests to server to check if there are any updates on the server. polling works fine but because of this, session is always kept active. And the session never gets timedout unless user manually logsout or closes the browser. This can be achieved by setting timeout in polling itself but we want to handle timeout logic in server side.

    Is there any way to keep the session idle during these ajax calls. Or we need to handle the timeout manually.

    We are using tomcat server 7.0.34, spring mvc 3.1.3 for view and controller and spring security 3.1.3. I have set the session timeout as soon as the new session is created.

    session.setMaxInactiveInterval(7200); //2hrs

    Any help in this regard is appreciated.

    Thanks, Ekanath

  • #2
    Each request triggers and update of the session, this is as specified in the servlet spec and as such works as designed... For the server a request is a request, being submitted from ajax or not... It is just a request...

    Also a session timeout of 2 hours seems a bit long.

    Comment


    • #3
      Thanks Marten for the reply. You are right, we can't differentiate type of request based on ajax/normal get/post.
      Anyways we solved this issue by handling session timeout manually by using a filter which is configured web.xml. We can't use httpsession timeout.
      The only problem is that it affects performance of the application as each request goes through this filter.

      Comment

      Working...
      X