code: URL parseLocalRefUrl(
              final HttpServletRequest request, final String refUrl) {
          URL rslt = null; // default
          if (StringUtils.isNotBlank(refUrl)) {
              try {
                  final URL context = new URL(request.getRequestURL().toString());
                  final URL location = new URL(context, refUrl);
  
                  if (location.getProtocol().equals(context.getProtocol())
                          && location.getHost().equals(context.getHost())
                          && location.getPort() == context.getPort()) {
                      rslt = location;
                  } else {
                      log.warn("The specified refUrl is not local:  " + refUrl);
                  }
              } catch (Exception e) {
                  log.warn("Unable to analyze specified refUrl:  " + refUrl);
                  log.debug(e);
              }
          }
          return rslt;
      }
docs: /* package-private