I have defined below rules for handling user session.
- When user logs in sessioncreate() of HttpSessionListener will be called and will set user status as online in database.
- When user logs out sessiondestroy() of HttpSessionListener will be called and will set user status as offline in database..
- When user closes the browser/tab, make AJAX call on browser unload/some_other event to destroy the session.
- Since we can not rely on browser events completely, use session_timeout on server side also. On Session timeout event, first make validation call from server to client and confirm if he/she is still available. If received acknowledgement from client, it means browser tab is still open. So we will not destroy the session.
Here in last rule, how to intercept the session destroy mechanism of spring ? How to skip session destroy if acknowledgement is received from client ?
Thanks,