code: public static void addCookie(
              HttpServletRequest request,
              HttpServletResponse response,
              String name,
              String value,
              String domain,
              int maxAge, boolean httpOnly) {
          String contextPath = request.getContextPath();
          if (contextPath == null || contextPath.isEmpty()) {
              contextPath = "/";
          }
          addCookie(request, response, name, value, domain, contextPath, maxAge,httpOnly);
      }
docs: add a cookie