Meaningless Drivel is fun!*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat - Reading/writing cookies" Watch "Tomcat - Reading/writing cookies" New topic
Author

Tomcat - Reading/writing cookies

Rob Page
Greenhorn

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.
System:
- Windows xp sp3 or linux CentOS 5
- Apache Tomcat Version 6.0.26
- Java Version 1.6.0.18

Configuration (catalina.properties):
  • 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:
    "1293009855734|<key1=value>|<key2=value>,<key3=value>|<key4=value>|<key5=value>"

    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:
    1293009855734|<key1=value>|<key2=value>,<key3=value>|<key4=value>|<key5=value>

    Sending a request on the second interface of the web-application I can log (server-side) the content of the cookie:
    1293009855734|<key1=value>|<key2=value>

    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.
    Rob
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Tomcat - Reading/writing cookies
     
    Similar Threads
    Record store gets overwritten
    How to convert query string into xml Structure
    problem
    How to Handle Properties
    Is a Map data type that holds three objects possible?