code: @Sensitive
      public String getReferrerURLFromCookies(HttpServletRequest req, String cookieName) {
          Cookie[] cookies = req.getCookies();
          String referrerURL = CookieHelper.getCookieValue(cookies, cookieName);
          if (referrerURL != null) {
              StringBuffer URL = req.getRequestURL();
              referrerURL = decodeURL(referrerURL);
              referrerURL = restoreHostNameToURL(referrerURL, URL.toString());
          }
          return referrerURL;
      }
docs: Retrieve the referrer URL from the HttpServletRequest's cookies.
  This will decode the URL and restore the host name if it was removed.
  
  @param req
  @return referrerURL