session active 1 hour !


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: session active 1 hour !

  1. #1
    Lydia Guest

    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?

  2. #2
    Kyle Gabhart Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center