title: Update domain of existing cookie
body: <p>I have a site name www.goo.com and i used to save cookie without declaring domain name when creating the cookie.
  Now, i want to add sub domain foo.goo.com
  I save the cookie in the domain and not in the sub domain.
  There are 2 problems:</p>
  
  <ol>
  <li><p>I want to delete the old cookie.
  I tried to  do 'cookie.setMaxAge(0)' already and the problem is  that in Firefox and chrome it do not work. it work only in IE.
  why? and what i can do about it?</p></li>
  <li><p>When i do </p>
  
  <pre><code>Cookie[] cookie = request.getCookies();
  if (cookie != null) {
     for (int i = 0; i &lt; cookie .length; i++) {
         cookie[i].getDomain();   //here i get null.why?
     }
  }
  </code></pre></li>
  </ol>
  
  <p>Why i get null in the getDomain() line? </p>
  
  <p><b>Edit: </b></p>
  
  <p>i tried to add this line:</p>
  
  <pre><code>response.setContentType("text/html");
  </code></pre>
  
  <p>to send the content type.</p>
  
  <p>I also tried to send the cookie through the response.</p>
  
  <p>Someone have another idea, for the 2 problems the presents here?</p>