code: public static boolean isURLFedoraServer(String url) {
  
          // scheme must be http or https
          URI uri = URI.create(url);
          String scheme = uri.getScheme();
          if (!scheme.equals("http") && !scheme.equals("https")) {
              return false;
          }
  
          // host must be configured hostname or localhost
          String fHost = CONFIG.getParameter(FEDORA_SERVER_HOST,Parameter.class).getValue();
          String host = uri.getHost();
          if (!host.equals(fHost) && !host.equals("localhost")) {
              return false;
          }
  
          // path must begin with configured webapp context
          String path = uri.getPath();
          String fedoraContext = CONFIG.getParameter(
                  FEDORA_SERVER_CONTEXT,Parameter.class).getValue();
          if (!path.startsWith("/" + fedoraContext + "/")) {
              return false;
          }
  
          // port specification must match http or https port as appropriate
          String httpPort = CONFIG.getParameter(FEDORA_SERVER_PORT,Parameter.class).getValue();
          String httpsPort = CONFIG.getParameter(FEDORA_REDIRECT_PORT,Parameter.class).getValue();
          if (uri.getPort() == -1) {
              // unspecified, so fedoraPort must be 80 (http), or 443 (https)
              if (scheme.equals("http")) {
                  return httpPort.equals("80");
              } else {
                  return httpsPort.equals("443");
              }
          } else {
              // specified, so must match appropriate http or https port
              String port = "" + uri.getPort();
              if (scheme.equals("http")) {
                  return port.equals(httpPort);
              } else {
                  return port.equals(httpsPort);
              }
          }
  
      }
docs: Tell whether the given URL appears to be referring to somewhere within
  the Fedora webapp.