title: Adding cookie in java and then HTTP redirect doesnt show cookie in client side
body: <p>I have requirement where in i need to add cookie in java and then redirect it to different URL. Now this url process should persist the cookie which i set and after its processing send it back to client. The code goes as follows</p>
  
  <pre><code>Cookie cookie = new Cookie("name", "value")
  // To make sure cookie is established for all the url paths
  cookie.setPath(request.getContextPath());
  response.addCookie(cookie);
  response.sendRedirect("someNewUrl");
  </code></pre>
  
  <p>Please help me regarding how can i persist the cookie throughout the redirect lifecycle and to the client. Thanks in advance.</p>