[opencms-dev] OpenCms 6 JSESSIONID cookie

Pere Torrodellas ptorrodellas at fihoca.com
Thu Sep 8 12:50:25 CEST 2005


Holidays didn't bring any further inspiration to solve our problem, so I did
some more tests.

In both cases (when a string is received OK and when it's received KO in the
OpenCms JSP), a trace of the HTTP packets reveals that the navigator encodes
the string in the same way, so, as I expected, the setting of the cookie
doesn't influence the way the navigator encodes strings. The only difference
between messages in both cases is the presence of the cookie when the string
is decoded OK in the server.

I defined a new very simple page with the same short POST form code in the
/sites/default/release OpenCms folder to eliminate folder definitions
effects and got these results:
- Setting the "Empty template" OpenCms template for the page, the cookie is
not set by the server and the string is not properly decoded when received
in the JSP.
- Setting the "Welcome / Release notes template" OpenCms template, the
cookie IS set and the string IS properly decoded when received in the JSP.

Can someone offer an explanation as to why the cookie is set by the server
for some folders and templates and not for others? And why this can affect
the decoding of request parameters?

Thanks,

Pere

----- Original Message -----
From: "Pere Torrodellas" <ptorrodellas at fihoca.com>
To: "The OpenCms mailing list" <opencms-dev at opencms.org>
Sent: Friday, August 19, 2005 9:11 AM
Subject: Re: [opencms-dev] OpenCms 6 JSESSIONID cookie


>
> Hello Jason, thanks for your reply.
>
> Yes, my understanding is that the session is managed by Tomcat, but the
fact
> that for the "bad" folder the cookie is not sent, and Tomcat doesn't know
> about VFS folders, made me suspect that OpenCms does something about it.
>
> The "good" and "bad" folders have de same pages in two different languages
> and use the same set of templates in a module... the only difference that
> I'm aware of is the "locale" property, which we use in templates and JSPs
to
> detect the language. Maybe OpenCms doesn't like the "ca" (the official
> locale for Catalan) in the "bad" folder?
>
> All pages in both folders that include the charset parm use "UTF-8", and
we
> do set <%@ page session="false" %>, but it's the same in both cases
because
> it's in the templates.
>
> I can't imagine why the setting of a cookie can influence the encoding,
but
> the fact is that as soon as it's set with one of the pages in the "good"
> folder, it's exchanged with the server for every page, even for the "bad"
> ones,  and the encoding starts to work as expected. Maybe it's just a
> coincidence with the true reason?
>
> I'm really puzzled, and hope that someone can offer an idea about what's
> going on there...
>
> Pere
>
> ----- Original Message -----
> From: "Jason Trump" <jason.trump at brulant.com>
> To: "The OpenCms mailing list" <opencms-dev at opencms.org>
> Sent: Thursday, August 18, 2005 3:18 PM
> Subject: RE: [opencms-dev] OpenCms 6 JSESSIONID cookie
>
>
> Hi Pere,
>
> The JSESSIONID is set by the servlet/JSP container (probably tomcat for
> you?), not by opencms.  You are correct in that it identifies the
> session for subsequent requests from the client.
>
> Unfortunately, I don't know how the setting of the session cookie could
> affect character encoding.  Here are a few guesses:  Are documents in
> that folder using a different template than other documents?  For
> example, maybe you have a JSP template somewhere that is explicitly
> setting encoding like
>
> <%@ page contentType="text/html; charset=FOOBAR" %>
>
> Or, do you have any page directives that disable sessions in your JSPs,
> like
>
> <%@ page session="false" %>
>
> though I don't think that this should prevent the session cookie from
> being set.  Perhaps somebody else on the list has a better idea?  What
> type of pages are in your 'bad' folder -- JSPs, XML content...?
>
> -jason
>
> > -----Original Message-----
> > From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-
> > bounces at opencms.org] On Behalf Of Pere Torrodellas
> > Sent: Thursday, August 18, 2005 7:22 AM
> > To: OpenCms
> > Subject: [opencms-dev] OpenCms 6 JSESSIONID cookie
> >
> > Hello,
> >
> > I am debugging a strange character encoding problem in our OpenCms
> > application, and so far the only difference I can see between correct
> and
> > incorrect encoding is the fact that OpenCms has sent or not a cookie:
> >
> > Set-Cookie: JSESSIONID=B50B9243698545E3CB3BEF9EF4F2AB39; Path=/socweb
> >
> > I assume that this is the cookie that identifyes the session, but
> > strangely
> > enough, OpenCms doesn't send it if the pages come from a particular
> > folder.
> >
> > After this cookie has been set, the accented vowels entered in forms
> are
> > encodede OK regardless of the page or folder, but not before. By the
> way,
> > everything in the application (as far as I'm aware) uses UTF-8.
> >
> > I can't see the difference in properties, etc, between the folder that
> > does
> > trigger the cookie and the folder that doesn't. Can someone please
> explain
> > when and when not does OpenCms send this cookie?
> >
> > And, how can this influence the character encoding in the navigator?
> >
> > Thanks for any hint,
> >
> > Pere
> >




More information about the opencms-dev mailing list