Can't add more than one cookie with the same name

Solution Verified - Updated -

Issue

  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);
        Cookie cookie1 = new Cookie("cookie1", "value1");
        cookie1.setDomain("*.cookie1.com");

        Cookie cookie1_1 = new Cookie("cookie1", "value1_1");
        cookie1_1.setDomain("*.cookie1_1.com");

        Cookie cookie2 = new Cookie("cookie2", "value2");
        cookie2.setDomain("*.cook2.com");

        resp.addCookie(cookie1);
        resp.addCookie(cookie1_1);
        resp.addCookie(cookie2);

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.1, 7.2
      • cookie with same name but different paths
      • cookie with same name but different domains

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content