File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes session timeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "session timeout" Watch "session timeout" New topic

session timeout

shailesh kumar
Ranch Hand

Joined: Jul 18, 2005
Posts: 36
In my application I have this session timeout javascript function and works well. I have to give timeout message to the user after 20 mins of inactivity. We have some applets also. But the timeout function gives the alert message even if the user is working on the applet. I understand that Browser and applet are two diffrent things, i guess thats why its not working properly. Is there a good way to implement this functionality in applets ?, please advice.


function ShowTimeoutWarning()
window.alert( "Your session has been timed out. As a security precaution, sessions are invalidated after 20 minutes of inactivity. You can log in again to resume.!" );

setTimeout( 'ShowTimeoutWarning();', 60000 );
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You could keep track of the time each time the user does something in the GUI; the event handlers would be a good place for this. If at some point the time since the last event is more than 20 minutes you can require a re-login.

But it sounds like you only want to time out if the user accesses neither the web page nor the applet - correct? For that you'd need to implement some kind of Java<-->JavaScript interaction; some hints on how to do that can be found here.
I agree. Here's the link:
subject: session timeout
It's not a secret anymore!