-
session active 1 hour !
hi,
I have a problem with the sessions I have a list of session (hashtable)
which I would like to make inactive to the end 1h of inactivity.
However, a session is invalid at the end of a half hour if one
does not reach it. Doesn't the fact of writing in the session change the
value returned from the method getLastAccessedTime()...
which must I make?
-
Re: session active 1 hour !
"Lydia" <mulerol@*******.com> wrote:
>
>hi,
>I have a problem with the sessions I have a list of session (hashtable)
>which I would like to make inactive to the end 1h of inactivity.
>However, a session is invalid at the end of a half hour if one
>does not reach it. Doesn't the fact of writing in the session change the
>
>value returned from the method getLastAccessedTime()...
>
>
>
>which must I make?
Hello,
If you want to override the default session length (which I believe is usually
20 minutes), then you must set the MaxAge field for the cookie object. The
setMaxAge() method allows you to set how long a session (associated through
a cookie) will remain active. The setMaxAge() method takes a single integer
as an argument speciying the number of seconds the session should remain
active. The following code snippet would specify that the session should
remain active for one hour:
Cookie cookie = new Cookie( "OneHourCookie", "uid1234" );
cookie.setMaxAge( 3600 );
response.addCookie( cookie );
I hope this is helpful. If you have any more questions, feel free to post
another question.
Happy Coding!
Cordially,
Kyle Gabhart
DevX Java Pro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks