Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-16298

[GSS](7.2.z) UNDERTOW-1489 - Can't add more than one cookie with the same name

XMLWordPrintable

    • +
    • Hide

      Just add the following code to a scriptlet on a JSP (or use the attached test.jsp:

          javax.servlet.http.Cookie c = new javax.servlet.http.Cookie("test", "test");
          c.setPath("/test");
      
          javax.servlet.http.Cookie cc = new javax.servlet.http.Cookie("test", "test");
          cc.setPath("/test2");
      
          response.addCookie(c);
          response.addCookie(cc);
      

      When the JSP is invoked we get the headers:

      Connection: keep-alive
      Content-Length: 183
      Content-Type: text/html;charset=UTF-8
      Date: Fri, 25 Jan 2019 14:30:41 GMT
      Server: JBoss-EAP/7
      Set-Cookie: test=test; path=/test2
      X-Powered-By: Undertow/1, JSP/2.3

      As it can be seen, only the second path has been added.

      Show
      Just add the following code to a scriptlet on a JSP (or use the attached test.jsp: javax.servlet.http.Cookie c = new javax.servlet.http.Cookie( "test" , "test" ); c.setPath( "/test" ); javax.servlet.http.Cookie cc = new javax.servlet.http.Cookie( "test" , "test" ); cc.setPath( "/test2" ); response.addCookie(c); response.addCookie(cc); When the JSP is invoked we get the headers: Connection: keep-alive Content-Length: 183 Content-Type: text/html;charset=UTF-8 Date: Fri, 25 Jan 2019 14:30:41 GMT Server: JBoss-EAP/7 Set-Cookie: test=test; path=/test2 X-Powered-By: Undertow/1, JSP/2.3 As it can be seen, only the second path has been added.

      When trying to add two cookies with the same name but different path the cookie is overwritten, and only the last path is actually set.

      This contrasts with the behavior of EAP 6.x where the two cookies are set correctly.

        1. test.jsp
          0.6 kB
          Tomas Briceno Fernandez

              flaviarnn Flavia Rainone
              rhn-support-tbriceno Tomas Briceno Fernandez
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: