Two Laptop Bag*
The moose likes Servlets and the fly likes How to implement this requirement? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "How to implement this requirement?" Watch "How to implement this requirement?" New topic
Author

How to implement this requirement?

Yongping Wang
Ranch Hand

Joined: May 15, 2001
Posts: 40
HI,
How to implement a code which can automatically logout a current user if the user doesn't do any request to server, say in 15 minutes interval? Any ideas? Thanks.
Yongping
ziqiang wu
Greenhorn

Joined: Jun 18, 2001
Posts: 25
I think you can use session.setMaxInactiveInterval(time) to auto disable an user if this user inactive for some time, you can set "time" to 900, 2000, or 10000 that is up to you.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
session.setMaxInactiveInterval(time)
will invalidate the session - if you want to do more than that, you can add a HttpSessionBindingListener to the session. When the session is invalidated, the listener will get called and you can clean up stuff.
Bill

------------------
author of:
Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140
Hi!,
The session can get invalidated after a predefined time interval. But you can not expect the page to get changed automatically. When the user will try to interact with the system, the page will change only then. There is nothing simpler that page will get changed automatically after say 15 min when the session expires becuase for that a program must check the status of session at a definite interval of time and if the session is invalidated it must change the page. Thst is ofcourse session binder.
Originally posted by Yongping Wang:
HI,
How to implement a code which can automatically logout a current user if the user doesn't do any request to server, say in 15 minutes interval? Any ideas? Thanks.
Yongping

------------------
Vikas Aggarwal
Technology Associate
Shakun Global Networks
[This message has been edited by vikinsa aggarwal (edited June 22, 2001).]


Vikas Aggarwal

Founder @
Leads and Deals Limited

www.LeadsAndDeals.com
 
Consider Paul's rocket mass heater.
 
subject: How to implement this requirement?