users@glassfish.java.net

Re: Using glassfish without cookies

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 10 Dec 2008 07:56:47 -0800

On 12/10/08 03:50, glassfish_at_javadesktop.org wrote:
> Hi.
> Can you help me DISABLE cookies within glassfish, and using for sessions only URL rewriting, please?
>

There are 2 ways of doing this:

1. Bundle a sun-web.xml with your webapp, and set "enableCookies" to
"false":

    <?xml version="1.0" encoding="UTF-8"?>
    <sun-web-app>
      <session-config>
        <session-properties>
          <property name="enableCookies" value="false" />
        </session-properties>
      </session-config>
    </sun-web-app>

2. Leverage the new Servlet 3.0 facilities for disabling cookies
programmatically,
    by declaring a ServletContextListener and implementing its
contextInitialized method
    as follows:

    public void contextInitialized(ServletContextEvent sce) {
        sce.getServletContext().setSessionTrackingModes(
            EnumSet.of(SessionTrackingMode.URL));
    }

Hope this helps.

Jan

> Thanks !
> [Message sent by forum member 'sandstorm_sh' (sandstorm_sh)]
>
> http://forums.java.net/jive/thread.jspa?messageID=320971
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>