title: Missing set-cookie header on POST in Spring MVC 3.1
body: <p>Cookies added to the HttpServletResponse during an $.ajax POST call do not appear in the response header (there is no set-cookie).  The same code does function properly during GET requests.</p>
  
  <p>I have the following code in an interceptor postHandle:</p>
  
  <pre><code>public void postHandle(HttpServletRequest request, HttpServletResponse response,
                             Object handler, ModelAndView modelAndView) throws Exception {
  .
  .
              Cookie cookie = new Cookie(User.USER_KEY, userAsJson);
              LOGGER.info("Cookie json is: " + userAsJson);
              cookie.setPath("/");
              response.addCookie(cookie);
              LOGGER.info("Header names: " + response.getHeaderNames());
              LOGGER.info("Set-cookie header(s): " + response.getHeaders("Set-Cookie"));
  }
  </code></pre>
  
  <p>I'm seeing this issue when returning from a request to this mapping:</p>
  
  <pre><code>@RequestMapping(value = "/api/user/wait", method = RequestMethod.POST)
  @ResponseBody
  public User waitingApi(HttpSession session) {
  </code></pre>
  
  <p>Ajax call parameters:</p>
  
  <pre><code>    var ajaxMessage = {
          url : '/api/user/wait',
          type : 'POST',
          success : waitCallback,
          error : waitErrorCallback
      };
  </code></pre>
  
  <p>On a GET I see the following in my logs:</p>
  
  <blockquote>
    <p>Cookie json is: { my valid json object } </p>
    
    <p>Header names: [Set-Cookie]</p>
    
    <p>Set-cookie header(s): [user="{ my valid json object }"; Version=1;
    Path=/]</p>
  </blockquote>
  
  <p>On a POST I see the following in my logs:</p>
  
  <blockquote>
    <p>Cookie json is: { my valid json object }</p>
    
    <p>Header names: [Content-Type, Transfer-Encoding, Date, Server]</p>
    
    <p>Set-cookie header(s): []   &lt;--- this is empty, not redacted</p>
  </blockquote>