File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Forward after a particular time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Forward after a particular time" Watch "Forward after a particular time" New topic
Author

Forward after a particular time

Murad Iqbal
Ranch Hand

Joined: Dec 09, 2003
Posts: 90
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

Joined: Sep 25, 2003
Posts: 327
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.


Anthony W.<br />MCP, SCJP 1.4, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Forward after a particular time