title: Java EE - Need 2 response.addCokie() method to actually set a cookie
body: <p>I'm learning Java EE and cookies and I'm trying to set a cookie. My problem is that I need to send a GET request twice to actually set the cookie.I tried to set it twice in doGet() method without any conditions, then I checked the result on PostMan and it worked, the cookie was set with a single request.</p>
  
  <p>I can't manage to understand my problem, that's why I'm asking for your kind help.</p>
  
  <p>I'm working on a Tomvat v7 server.</p>
  
  <pre><code>//Won't work
  protected void doGet(...){
      Cookie cookie = new Cookie("cookie", "value");
      response.addCookie(cookie);
  }
  
  //Will work
  protected void doGet(...){
      Cookie cokie = new Cookie("cookie", "value");
      response.addCookie(cookie);
      response.addCokkie(cookie);
  }
  </code></pre>
  
  <p>Thank you in advance !</p>
  
  <p>Arthur</p>