code: public static void addCookie(HttpServletRequest request, HttpServletResponse response, String name,
        String value, String path, int age) {
      LOG.debug("add cookie[name:{},value={},path={}]", new String[] { name, value, path });
      Cookie cookie = null;
      try {
        cookie = new Cookie(name, URLEncoder.encode(value, "utf-8"));
      } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
      }
      cookie.setSecure(false);
      cookie.setPath(path);
      cookie.setMaxAge(age);
      cookie.setHttpOnly(true);
      response.addCookie(cookie);
    }
docs: Convenience method to set a cookie <br>
  刚方法自动将value进行编码存储<br>
  
  @param response
  @param name
  @param value
  @param path