code: public static void failureCookie(HttpServletRequest request,
                                       HttpServletResponse response, String name, String domain) {
          String contextPath = request.getContextPath();
          if (contextPath == null || contextPath.isEmpty()) {
              contextPath = "/";
          }
          failureCookie(request, response, name, domain, contextPath);
      }
docs: failure a cookie