9 Replies Latest reply on Sep 14, 2013 8:59 AM by hcraj

    Cookie Issue with latest JBoss/TC Bundle

      We just upgraded from JBoss 4.0.0/TC to JBoss 4.0.2/TC (JDK 1.5).

      We noticed a strange issue in the new version where whenever we set a cookie with a value that had a space in it the value is store with double quotes around the value. This was not the case with the previous version.

      For example we set a cookie like this:

      c = new Cookie("c_name", "Test value");

      If we look at the cookie we see:
      c_name
      "Test value"

      A problem arrises when we go to read that value with cookie.getValue(). The value that is returned actually has the quotes in it.

      So, cookie.getValue on the cookie from the above example would return \"Test value\"

      Is this a known issue? Something we are not doing properly? Workarounds?

      Thanks

        • 1. Re: Cookie Issue with latest JBoss/TC Bundle
          maumau

          I have the same problem and found no workaround

          • 2. Re: Cookie Issue with latest JBoss/TC Bundle
            saschwen

            Has anyone found a fix for this? I'm trying to port over a large app from another application server and I am running into the same problem.

            Thank you,

            Steve.

            • 3. Re: Cookie Issue with latest JBoss/TC Bundle
              anil.saldhana

              Tested this against the codebase going to be jboss 4.0.4 and I see no problems.
              Try with jboss 4.0.3 and tell us if you still see the issues:

              15:06:26,890 INFO [Server] JBoss (MX MicroKernel) [4.0.4beta (build: CVSTag=Bra
              nch_4_0 date=200510261736)] Started in 1m:7s:78ms
              15:06:49,390 INFO [[/identity-new]] Identity Test Servlet: Setting cookie:domai
              n:locahost:path=/:name=jbossssocookie:value=8177090_1133298409390
              


              My cookie code is as follows:
              private Cookie createCookie(String domain)
               {
               String token = "" + this.hashCode() + "_" + System.currentTimeMillis();
               Cookie cookie = new Cookie("jbossssocookie",token);
               cookie.setDomain(domain);
               cookie.setPath("/");
               cookie.setMaxAge(-1);
               return cookie;
               }
              


              • 4. Re: Cookie Issue with latest JBoss/TC Bundle
                saschwen

                Hello,

                I've upgraded from 4.0.2 to 4.0.3 and have tried my app again and I'm still getting the quotes.

                The cookie value should be 1,1,3,520,CA,Ontario,ad_type?step=init but the actual value I get is "1,1,3,520,CA,Ontario,ad_type?step=init"

                Could this be an underlying problem with tomcat?

                • 5. Re: Cookie Issue with latest JBoss/TC Bundle
                  saschwen

                  Hello,

                  I've also found an odd problem with this cookie.

                  For some reason after redirecting to another url, jboss parses the cookie oddly. What happens is jboss splits the cookie where the commas are. For example say the cookie is named people and the value is(with the quotes) "bob,joe,steve,ian". Jboss creates the cookies with the following key value pairs.

                  people="bob
                  joe=
                  steve=
                  ian"=

                  The = sign is the key value separator. I'm not sure why jboss does this, but I found this info about jetty. Does jboss use jetty?


                  Jetty-4.1.D2 - 24 June 2002
                  + Support trusted external authenticators.
                  + Moved jmx classes from JettyExtra to here.
                  + Set contextloader during webapplicationcontext.start
                  + Added AJP13 listener for apache integration.
                  + Fixed ChunkableOutputStream close propagation
                  + Better recycling of HttpRequests.
                  + Protect session.getAttributeNames from concurrent modifications.
                  + Allow comma separated cookies and headers
                  + Back out Don't chunk 30x empty responses.
                  + Conditional header tested against welcome file not directory.
                  + Improved ThreadedServer stopping on bad networks
                  + Use ThreadLocals to avoid unwrapping in Dispatcher.



                  Can anyone help? Please!!!

                  • 6. Re: Cookie Issue with latest JBoss/TC Bundle
                    saschwen

                    sorry,

                    I forgot to mention to look at the point that says "Allow comma separated cookies and headers" could that patch somehow created this bug?

                    • 7. Re: Cookie Issue with latest JBoss/TC Bundle
                      vickyk

                      Does this happens only with the cookies values which are having spaces or for all ?

                      Vicky

                      • 8. Re: Cookie Issue with latest JBoss/TC Bundle

                        Yes Vicky, I tried with Cookie value having " - " in it and it gave back cookie value surrounded by double quotes("") but when I changed the value to remove spaces and have "-", then it started giving me proper cookie value string without surrounding double quotes.

                        I am using JBoss_4_0_4_GA.

                        • 9. Re: Cookie Issue with latest JBoss/TC Bundle
                          hcraj

                          Hello  All,

                           

                          Even i am getting double quotes while reading cookie. This is happening with JBoss EAP 6.  Anyone has any suggestion.