• Post Reply Bookmark Topic Watch Topic
  • New Topic

Understanding What happens at Session Destroyed  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1784
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will even the javascript timers stop firing when a timeout occurs?

As I have a timer(1 minute) that makes a AJAX request to update a message display. In my filter, after so much time has elapsed, checking for all servlet requests except the one that updates the message display, I set the AJAX timer to 1 minute greater than my timeout setting.

After timeout I would like to display in the AJAX message a timed out message.

Right now it all works great except the user, even though I display a warning message that a time out will happen shortly due to inactivity, does not know the time out has occurred until they try and make a request using one of the apps functions.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve Dyke wrote:Will even the javascript timers stop firing when a timeout occurs?

No. JavaScript executes in the browser and has no knowledge or even notion of a session.

Right now it all works great except the user, even though I display a warning message that a time out will happen shortly due to inactivity, does not know the time out has occurred until they try and make a request using one of the apps functions.

Expecting the user to not do certain actions after a session has expired is not reasonable. Your Ajax code must be able to handle the case where a request fails because the session has timed out.
 
Steve Dyke
Ranch Hand
Posts: 1784
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Expecting the user to not do certain actions after a session has expired is not reasonable. Your Ajax code must be able to handle the case where a request fails because the session has timed out.


Yes, I understand this. But from the application perspective I would like to mimic a request being made so the Message Display I have set up will show Session has Expired message.

For some reason after the session timesout the timer(making a request to refresh the Message Display) does not fire again.

Also I have setMaxInactiveInterval(300) but it is more like 8+ minutes before the timeout actually happens.

This is my filter code(you can see where I set the message timer to timeout plus 4 minutes):

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!