File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat - Reading/writing cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat - Reading/writing cookies" Watch "Tomcat - Reading/writing cookies" New topic

Tomcat - Reading/writing cookies

Rob Page

Joined: Dec 01, 2010
Posts: 4
Hi all,
I'm experiencing a couple of troubles writing and reading cookies in a web-applications.
Especially seems that Tomcat eats part of a cookie, I'm sure about it because sniffing w/ wireshark I can see the whole cookie arriving on my server, but printing the content inside my web-application results in just part of it.
Note: the web-application inserts the cookie on an interface and reads it on another one.
- Windows xp sp3 or linux CentOS 5
- Apache Tomcat Version 6.0.26
- Java Version

Configuration (
  • org.apache.catalina.STRICT_SERVLET_COMPLIANCE = "false"
    org.apache.tomcat.util.http.ServerCookie.ALLOW_EQUALS_IN_VALUE = "true"

  • Code for setting the cookie (part of business logic behind first interface):

    Verifying the cookie content browser-side on Firefox w/ Cookie Editor plug-in I can see:

    Here comes the first trouble, why does it write "" delimiting the correct content ?

    Modifying the cookie content browser-side on Firefox w/ Cookie Editor plug-in I obtain:

    Sending a request on the second interface of the web-application I can log (server-side) the content of the cookie:

    This is the second trouble, the cookie is trunkated like a version 0 cookie instead of a version 1 that allows characters like ,"= etc.

    Thank you for your time.
    I agree. Here's the link:
    subject: Tomcat - Reading/writing cookies
    It's not a secret anymore!