You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Heiko Klein <He...@gmx.net> on 2006/09/10 14:27:55 UTC
Persistent session after browser restart, cookie expiration
Hi,
I'm currently moving an web-application from custom-made to
tomcat-servlet. Before, I used my own cookie management to store
user-preferences. The cookies had a persistence on the browser of 1
year, if the browser-configuration allowed that.
The default tomcat cookies for session-management seem to be deleted
with browser-restart. How can I keep a session open even if the user
restarts his computer? Or in other words, how can I set the 'Expires'
field of the session-cookie send to the browser?
Best regards,
Heiko
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Persistent session after browser restart, cookie expiration
Posted by Dies Koper <di...@jp.fujitsu.com>.
Hello Heiko,
I think you're looking for the following method:
javax.servlet.http.Cookie#setMaxAge(int expiry)
Its default value (see getMaxAge()) is -1 => the cookie persists until
browser shutdown.
Regards,
Dies
Heiko Klein wrote:
> Hi,
>
> I'm currently moving an web-application from custom-made to
> tomcat-servlet. Before, I used my own cookie management to store
> user-preferences. The cookies had a persistence on the browser of 1
> year, if the browser-configuration allowed that.
>
> The default tomcat cookies for session-management seem to be deleted
> with browser-restart. How can I keep a session open even if the user
> restarts his computer? Or in other words, how can I set the 'Expires'
> field of the session-cookie send to the browser?
>
> Best regards,
>
> Heiko
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Persistent session after browser restart, cookie expiration
Posted by Marc Richards <mj...@yahoo.com>.
Could be wrong, but it doesn't sound like you really
want to use sessions for this usage because session
attributes are stored in memory in Tomcat (unless
you're using a backup manager). In time, you will
have many sessions and cap your physical memory. It
sounds like you just need to use a regular old cookie
instead.
-marc
--- Alexander Lazic <al...@none.at> wrote:
> Hi,
>
> On Son 10.09.2006 14:27, Heiko Klein wrote:
> >
> >The default tomcat cookies for session-management
> seem to be deleted
> >with browser-restart. How can I keep a session open
> even if the user
> >restarts his computer? Or in other words, how can I
> set the 'Expires'
> >field of the session-cookie send to the browser?
>
> Could it be in conf/web.xml the session-config
> setting, or in the
> app-dir/WEB-INF/web.xml?!
>
> Regards
>
> Alex
>
>
---------------------------------------------------------------------
> To start a new topic, e-mail:
> users@tomcat.apache.org
> To unsubscribe, e-mail:
> users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Persistent session after browser restart, cookie expiration
Posted by Alexander Lazic <al...@none.at>.
Hi,
On Son 10.09.2006 14:27, Heiko Klein wrote:
>
>The default tomcat cookies for session-management seem to be deleted
>with browser-restart. How can I keep a session open even if the user
>restarts his computer? Or in other words, how can I set the 'Expires'
>field of the session-cookie send to the browser?
Could it be in conf/web.xml the session-config setting, or in the
app-dir/WEB-INF/web.xml?!
Regards
Alex
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org