title: Persistent cookies from a servlet in IE
body: <p>I have a cookie which is generated from a servlet and that  I would like to be persistent - that is, set the cookie, close down IE, start it back up, and still be able to read the cookie.  The code that I'm using is the following:</p>
  
  <pre><code>HttpServletResponse response = 
      (HttpServletResponse) FacesContext.getCurrentInstance()
      .getExternalContext().getResponse();
  
  Cookie cookie = new Cookie("someKey", "someValue");
  cookie.setMaxAge(7 * 24 * 60 * 60);
  response.addCookie(cookie);
  </code></pre>
  
  <p>This works great in firefox, but in IE 6/7, the cookie is not saved between browser restarts.  I've checked everything that I can think of in my settings, but can't figure out what would be causing the cookie to be deleted.  As far as I know, calling setMaxAge with a positive number makes the cookie persistent.  Any ideas why this would be going wrong?</p>
  
  <p><b>Edit</b></p>
  
  <p>I have verified, using the more info trick suggested by Olaf, that the cookie is attempting to be set as a session cookie, not a persistent cookie; the max age is set to "end of session".  So it doesn't seem like the max age is being set for IE - I have verified that in Firefox, the max age is set correctly.  I still have no idea what's going on.</p>