On 11/28/09 09:39, glassfish_at_javadesktop.org wrote:
> Is it possible to allow a session to persist a browser shutdown? I suspect the JSESSIONID cookie would need to be made a permanent instead of a session cookie but I haven't found a way to do that.
>
> Specifically I'm trying to allow a logged in user to resume their session after their browser is shutdown and restarted.
>
Yes, this can be done using the new configuration capabilities for
session tracking cookies provided by Servlet 3.0 (and implemented
by GlassFish v3):
You can set the expiration of time of your application's session tracking
cookies declaratively, by specifying the max-age element in your
web.xml deployment descriptor, as follows:
<web-app [...]>
<session-config>
<cookie-config>
<max-age>...</max-age>
</cookie-config>
</session-config>
</web-app>
or programmtically (e.g., from a ServletContextListener), as in the
following example:
public class ConfigListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent sce) {
sce.getServletContext().getSessionCookieConfig().setMaxAge(...);
}
If you are using a pre-v3 GlassFish release, you can configure the
expiration of your application's session tracking cookies using the
(non-portable) sun-web.xml deployment descriptor, as follows:
<sun-web-app>
<session-config>
<cookie-properties>
<property name="cookieMaxAgeSeconds" value="..." />
</cookie-properties>
</session-config>
</sun-web-app>
Jan
> [Message sent by forum member 'sol1001' ]
>
> http://forums.java.net/jive/thread.jspa?messageID=373673
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>