users@glassfish.java.net

Re: How to prevent Glassfish v2 to rewrite urls with jsessionid?

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Tue, 27 Jan 2009 11:24:18 -0800

On 01/27/09 03:03, glassfish_at_javadesktop.org wrote:
> Is session rewriting and session cookies an either or way in glassfish?
> Tried to set
> <session-properties>
> <property name="enableCookies" value="true" />
> <property name="enableURLRewriting" value="true"></property>
> </session-properties>
> in my sun-web.xml. But this fix prevents that jsession id is appended in encode(Redirect)URL/CoyoteResponse. hreq.isRequestedSessionIdFromCookie() returns false BUT getContext().getCookies() is true and prevents the rewrite!!!
>
> if (hreq.isRequestedSessionIdFromCookie() ||
> (getContext() != null && getContext().getCookies()))
>

The

  getContext() != null && getContext().getCookies()

check was added in order to address

  https://glassfish.dev.java.net/issues/show_bug.cgi?id=3972
  ("HttpServletResponse.encodeURL() unconditionally appends jsessionid
   if session is newly created")

This means that you must remove this line from your sun-web.xml:
 
  <property name="enableCookies" value="true" />

if you want the jsessionid to be included in the rewritten URL.

See also https://glassfish.dev.java.net/issues/show_bug.cgi?id=7091

Thanks,


Jan

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