Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpSession timeout does not happen with jquery polling

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 as application server, spring mvc for view and controller. 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

like image 664
Ekanath Avatar asked Nov 03 '22 01:11

Ekanath


1 Answers

You can not configure am ignore URL for the HTTP Servlet container session management. (There is only one setting in session-config of web.xml: session-timeout) You need to implement your own timer and invalidate session when it is required.

like image 68
Michael Avatar answered Nov 12 '22 15:11

Michael