code: public void sendPermanentCookie(String name, String value) {
          Cookie cookie = new Cookie(name, value);
          cookie.setMaxAge(60*60*24*365*20);
          RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie));
      }
docs: Sends long to live cookie to browse with response. This cookie will be asked to live for 20 years.
  
  @param name name of cookie
  @param value value of cookie.