title: How to delete a cookie on server with JAX-RS NewCookie?
body: <p>I want to delete cookie on server (by means of setting <code>Expires</code> to the past). How can I do this with <code>javax.ws.rs.core.NewCookie</code>? I'm trying this, but it doesn't work:</p>
  
  <pre><code>return Response.ok()
    .entity("hello world!")
    .cookie(
      new NewCookie(
        "foo",
        "",
        "/",
        ".example.com",
        1,
        "no comment",
        0, // maxAge
        false
      )
    )
    .build();
  </code></pre>
  
  <p>This snippet produces this HTTP header:</p>
  
  <pre><code>Set-Cookie:foo=;Version=1;Comment="no comment";Domain=.example.com;Path=/
  </code></pre>
  
  <p>This header doesn't delete the cookie from the server. What is a possible workaround?</p>