Andre-John Mas wrote:
> Hi,
> 
> The company I am working for is in the process of migrating from Tomcat
> 5.x.x to Tomcat5.5.27. In doing so we noticed that the any cookie value
> containing a colon will have the value trimmed up to before that
> character. This is new. A work around is to add quotes around the value,
> but we were hoping to avoid such changes:

Using a ':' in a v0 cookie is not legal. You have to use a v1 cookie
which is as simple as using:
cookie.setVersion(1);

5.5.28 will (hopefully - if it gets enough votes) an feature (enabled by
default) to automatically switch invalid v0 cookies to v1 cookies and
quote them.

Mark

> 
> To write:
> 
>     Cookie cookie = new
> Cookie("PROFILE_UPDATE_TS_X","2009-04-16T23:34:19Z"");
>     cookie.setSecure(true);
>     cookie.setPath("/");
>     response.addCookie(cookie);
> 
> To read:
> 
>     /**
>       * This is a convenience method for getting a cookie by name. If the
>       * cookie is not present in the request, a null value will be
> returned.
>       */
>      protected Cookie getCookie ( String cookieName, HttpServletRequest
> request ) {
>          Cookie[] cookies = request.getCookies();
>          for ( int i=0; i<cookies.length; i++ ) {
>              if ( cookies[i].getName().equals(cookieName) ) {
>                  return cookies[i];
>              }
>          }
>          return null;
>      }
> 
> This is certainly a regression.
> 
> André-John---------------------------------------------------------------------
> 
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to