Reputation: 841
I am using this below code in servlet for setting session timeout.
session.setMaxInactiveInterval( 5 * 60 );
It works well. But now send the polling request to server from js (Using jQuery) for every minute. This request refresh the session time out, so my session didn't logout.
How to solve this problem? I search in google. But I didn't find any suitable answer for this.
Thanks in advance.
Upvotes: 0
Views: 685
Reputation: 279880
As far as I know, this is not possible. The ajax request will be sent with the JSESSIONID cookie that your browser previously saved. Any time the Servlet container gets hit with that JSESSIONID and it has a corresponding HttpSession
, it will reset its timeout interval.
The point of polling is to keep something alive by checking it. You might have to rethink your requirement or your implementation.
Upvotes: 1