2015-12-01 19:17 GMT+01:00 Jose María Zaragoza <demablo...@gmail.com>:
> 2015-12-01 18:30 GMT+01:00 Jerry Malcolm <techst...@malcolms.com>:
>> I'm looking for a way to detect that the current session has expired (or
>> logged out via another tab on the browser).  I know I could just issue dummy
>> requests to the server and see if a login page comes back.  But issuing
>> requests automatically resets the session timer.
>
> Only if the request goes to the same application.
> You can create a HttpSessionListener who saves some info on a shared
> store when session is expired.
> Anothe REST service could check the status of the session when is
> requested by your page


Other option is to use Comet long polling ( requires servlet 3.x )
with an only one event sent by server to browser :session expired
When browser receives it, stop polling until user is logged in again

Or websockets ...



>
> You only need to think the way to map  Tomcat session with REST
> requests ( a random string created on load page  and store it in a
> local javascript variable and sent to server when logging in ? I don't
> know )
>
>
>
>
> I need a benign way to
>> query that doesn't keep the session alive forever.
>>
>> I'm sure this problem has been solved before.  But basically, I want to know
>> that the session is no longer valid and force the user back to the login
>> page.  I know one possibility is to set the Tomcat timer to 30 min
>> expiration, and then keep a '29 minute' timer running in the browser.  But
>> my clients can change the tomcat session timer length.  And also this
>> doesn't account for a logoff using the same session on a different browser
>> tab.  I'd really like a pro-active query method if anything like that
>> exists.
>>
>> Suggestion?
>>
>> Thanks.
>>
>> Jerry
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to