code: public void saveRequestUrlAndParameters(HttpServletRequest request, HttpServletResponse response) {
          String cookieName = ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME;
          ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler();
          Cookie c = referrerURLCookieHandler.createCookie(cookieName, getRequestUrlWithEncodedQueryString(request), request);
          response.addCookie(c);
  
          savePostParameters(request, response);
      }
docs: Saves the original request URL and any POST parameters.