Forums Register Login

Dynamic Session Lengths?

+Pie Number of slices to send: Send
Is it possible to change the length of session timeout dynamically for each user based on some data I make up? For example:
1. Anyone logged in as admin, I give a 30 minute timeout on their session
2. Employee logins get 1 hour session timeout
3. Regular users get 10 minute session timeout
How would I do this?
+Pie Number of slices to send: Send
Each time a user logs on you use:
HttpSession session;
session.setMaxInactiveInterval(60 * 30); //Your length
You just have to pull the actual values based on each user.
+Pie Number of slices to send: Send
Robert,
I suppose if you are using the Server side sessions in which case , you can use the solution as specified by Smith.
If you are using cookies based session - cookie.setMaxAge can be used to manipulate the cookie's (session) Age.
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 518 times.
Similar Threads
Session timeout in struts
session-timeout doesn't work in JBoss - why not?
session timeout
doubt in session
Correct way to use getSession() in actions?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:08:53.