tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars George <>
Subject Problem with Cookie.getValue
Date Sun, 19 May 2002 23:27:01 GMT

I hope this is the right place to ask this question. If not I apologize and
please let me know where to post this instead.

I am confused about the setting and getting of cookie values. Could someone
of the dev team shed a light on this? The question is, why does the cookie
value get urlencoded before setting the header field but NOT decoded when
receiving the cookie back?

Here it's set (

        maybeQuote(version, buf, URLEncoder.encode(value));

And in it is read like this

        sc.getValue().setBytes( bytes, startValue, endValue-startValue);

and set later in

        ServerCookie scookie = cookies.getCookie(j);
        Cookie cookie = new Cookie(scookie.getName().toString(),

We realized this change of behaviour after changing from JServ to Tomcat
4.0.3. Suddenly or code failed because we set a cookie value that was used
to come back as-is. With Tomcat it now comes back urlencoded and we have to
place a decode around each Cookie.getValue() call to fix our code.

Is this intentionally?

Kind regards,


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message