title: Vaadin 7 : How to update Cookie value?
body: <p>Methods for cookie management these I use as below</p>
  
  <pre><code>public static Cookie getCookieByName(final String name) {
      // Fetch all cookies from the request
      Cookie[] cookies = VaadinService.getCurrentRequest().getCookies();
  
      // Iterate to find cookie by its name
      for (Cookie cookie : cookies) {
          if (name.equals(cookie.getName())) {
              return cookie;
          }
      }
  
      return null;
  }
  
  public static Cookie createCookie(final String name, final String value, final int maxAge) {
      // Create a new cookie
      Cookie cookie = new Cookie(name, value);
  
      cookie.setMaxAge(maxAge);
  
      // Set the cookie path.
      cookie.setPath(VaadinService.getCurrentRequest().getContextPath());
  
      // Save cookie
      VaadinService.getCurrentResponse().addCookie(cookie);
  
      return cookie;
  }
  
  public static Cookie updateCookieValue(final String name, final String value) {
      // Create a new cookie
      Cookie cookie = getCookieByName(name);
  
      cookie.setValue(value);
  
      // Save cookie
      VaadinService.getCurrentResponse().addCookie(cookie);
  
      return cookie;
  }
  
  public static void destroyCookieByName(final String name) {
      Cookie cookie = getCookieByName(name);
  
      if (cookie != null) {
          cookie.setValue(null);
          // By setting the cookie maxAge to 0 it will deleted immediately
          cookie.setMaxAge(0);
          cookie.setPath("/");
          VaadinService.getCurrentResponse().addCookie(cookie);
      }
  }
  </code></pre>
  
  <p>I can select,create and destroy for cookies but I can't update cookie's value with my method <code>updateCookieValue(final String name, final String value)</code> . I tested in both Firefox and Chrome browser as <code>updateCookieValue(LOCALE_COOKIE, "en");</code> but locale value of browsers didn't change. What's wrong with my method ?</p>