title: Setting cookie from doFilter method
body: <p>I have a filter class with doFilter method. In the doFilter method, I am setting a cookie as follows</p>
  
  <pre><code>HttpServletResponse httpResp=(HttpServletResponse)servletResponse;
  Cookie myCookie=new Cookie("test","");
  myCookie.setValue("testValue");
  myCookie.setPath("/");
  myCookie.setDomain(".mydomain.com");
  httpResp.addCookie(myCookie);
  filterChain.doFilter(servletRequest,servletResponse); 
  </code></pre>
  
  <p>Should this ideally work? Setting a cookie in httpResp(HttpServletResponse) object and then just forwarding servletResponse(ServletResponse) object <br/></p>
  
  <p>Strangely the cookie is set for some clients but for some others the cookie is not set. I have checked the cookie settings on client's browser and it looks ok. </p>