Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forward after a particular time

 
Murad Iqbal
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a scenario. I am running a Timer upon user login in my web app. The user can freely browse the website after logging in succesfully. However, after a particular time has been passed (which is configurable), say 20 minutes, the user should be redirected to a security question page for security purposes. The current page of the user should be vanished and the security question page should appear. Is there a neat solution for this? I am using RequestDispatcher.forward for my responses.

Regards,
Murad.
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could store the login time as a session variable and compare it to the current time when the user requests a page.

I do not think there is any way for the web server to initiate an HTTP conversation with the browser and tell it to do something, (such as go to a different page). I think that the client has to initiate all conversations with the server. Using JavaScript, you could require all pages to refresh themselves every few minutes, which would allow the logic from my first paragraph to get control and redirect if necessary. Of course, the user could always disable JavaScript.

You can never stop people from viewing content and saving it off locally to be viewed for as long as they wish. Your best bet is to do your redirect if the user requests a new page after your specified interval.

Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic