Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-919

Set-Cookie "Expires" attribute breaks JAX-RS client

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.3.Final
    • 3.0.2.Final
    • jaxrs
    • None

      Using max-age on cookies trigger Jetty to forcibly add "Expires" attribute to the Cookie.

      The problem is that NewCookieHeaderDelegate does not recognize the "Expires" header, which break parsing of the cookie entirely.

      • Example request from the client:

      Builder builder = ClientBuilder.newClient().target(uri).request();
      Response response = builder.buildGet().invoke();

      • HTTP response from the server:

      Set-Cookie: guid=1.9112608617070927872;Path=/;Domain=localhost;Expires=Thu, 03-May-2018 10:36:34 GMT;Max-Age=150000000
      Expires: Thu, 01 Jan 1970 00:00:00 GMT
      Content-Length: 0
      Server: Jetty(9.0.4.v20130625)

      • Printing cookies results in:

      for (String key : response.getCookies().keySet()) {
      System.out.println("[" + key + "]=[" + response.getCookies().get(key) + "]");
      }

      [03-May-2018 10:46:21 GMT]=[03-May-2018 10:46:21 GMT=;Version=1;Domain=localhost;Path="/";Max-Age=150000000]

              patriot1burke@gmail.com Bill Burke (Inactive)
              krisskross_jira Kristoffer Sjögren (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: