Remove only the host name from the specified URL String.

@param url A valid URL string
@return
779861
@Sensitive
    protected String removeHostNameFromURL(@Sensitive String url) {
        try {
            int doubleSlash = url.indexOf("//");
            int firstSingleSlash = url.indexOf("/", doubleSlash + 2);
            URL originalURL = new URL(url);
            StringBuffer workURL = new StringBuffer();
            workURL.append(originalURL.getProtocol());
            workURL.append("://");
            int port = originalURL.getPort();
            if (port != -1) {
                workURL.append(":");
                workURL.append(port);
            }
            url = workURL.append(url.substring(firstSingleSlash)).toString();
        } catch (java.net.MalformedURLException e) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "removeHostNameFromURL", new Object[] { e });
            }
        }
        return url;
    }
244545
protected String getHostname(String url) {
        if (log.isDebugEnabled()) {
            log.debug("getHostname - url: {}", url);
        }
        String[] parts = url.split("/");
        if (parts.length == 2) {
            return "";
        } else {
            String host = parts[2];
            // strip out default port in case the client added the port explicitly
            if (host.endsWith(":1935")) {
                // remove default port from connection string
                return host.substring(0, host.length() - 5);
            }
            return host;
        }
    }
580633
public void removeConnectionPool(URL url) {
        RequestBuilder req = new RequestBuilder();
        req.host = url.getHost();
        req.port = url.getPort() < 0 ? url.getDefaultPort() : url.getPort();
        removePool(req);
    }
1368495
private static String stripHostname(final String originalHostname) {

		// Check if the hostname domains the domain separator character
		final int index = originalHostname.indexOf(DOMAIN_SEPARATOR);
		if (index == -1) {
			return originalHostname;
		}

		// Make sure we are not stripping an IPv4 address
		final Matcher matcher = IPV4_PATTERN.matcher(originalHostname);
		if (matcher.matches()) {
			return originalHostname;
		}

		if (index == 0) {
			throw new IllegalStateException("Hostname " + originalHostname + " starts with a " + DOMAIN_SEPARATOR);
		}

		return originalHostname.substring(0, index);
	}
1124158
public static String stripDoubleSeps(String url) {
        while( url.indexOf("//") > 0 )
            url = url.replace("//","/");
        return url;
    }
55139
public static String stripDefaultPortFromUrl(String url) {
		String scheme = urlToScheme(url);
		if(scheme == null) {
			return url;
		}
		int defaultPort = schemeToDefaultPort(scheme);
		if(defaultPort == -1) {
			return url;
		}

		String portStr = null;
		// is there a slash after the scheme?
		int slashIdx = url.indexOf('/', scheme.length());
		if(slashIdx == -1) {
			portStr = String.format(":%d", defaultPort);
			if(url.endsWith(portStr)) {
				return url.substring(0,url.length() - portStr.length());
			}
		}
		portStr = String.format(":%d/", defaultPort);
		int idx = url.indexOf(portStr);
		if(idx == -1) {
			return url;
		}
		// if that occurred before the first / (after the scheme) then strip it:
		if(slashIdx < idx) {
			return url;
		}
		// we want to strip out the portStr:
		StringBuilder sb = new StringBuilder(url.length());
		sb.append(url.substring(0,idx));
		sb.append(url.substring(idx + (portStr.length()-1)));
		return sb.toString();
	}
1077192
public static void removeHost(String hostName) throws Exception {
        changeHost(hostName, false, false, true, false, false);
    }
542528
public static String removeQueryParameter(String url, String key) {
    String[] urlParts = url.split("\\?");

    if (urlParts.length == 2) {
      Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]);
      if (paramMap.containsKey(key)) {
        String queryValue = paramMap.get(key).get(0);
        String result = url.replace(key + "=" + queryValue, "");
        // improper separators have to be fixed
        // @TODO find a better way to solve this
        result = result.replace("?&", "?").replace("&&", "&");
        if (result.endsWith("&")) {
          return result.substring(0, result.length() - 1);
        } else {
          return result;
        }
      }
    }
    return url;
  }
183080
public static String stripURLScheme(String url) {
		String lcUrl = url.toLowerCase();
		for(String scheme : ALL_SCHEMES) {
			if(lcUrl.startsWith(scheme)) {
				return url.substring(scheme.length());
			}
		}
		return url;
	}
574052
public void removeURLs(URL... urls) {
		final Set<URL> set = new HashSet<>();
		set.addAll(Arrays.asList(this.ucp.getURLs()));
		set.removeAll(Arrays.asList(urls));
		final URL[] tab = new URL[set.size()];
		set.toArray(tab);
		this.ucp = new sun.misc.URLClassPath(tab);
	}
237978
public HttpField remove(String name) {
        HttpField removed = null;
        for (int i = _size; i-- > 0; ) {
            HttpField f = _fields[i];
            if (f.getName().equalsIgnoreCase(name)) {
                removed = f;
                System.arraycopy(_fields, i + 1, _fields, i, --_size - i);
            }
        }
        return removed;
    }
403348
public URLNormalizer replaceIPWithDomainName() {
        URL u = toURL();
        if (!PATTERN_DOMAIN.matcher(u.getHost()).matches()) {
            try {
                InetAddress addr = InetAddress.getByName(u.getHost());
                String host = addr.getHostName();
                if (!u.getHost().equalsIgnoreCase(host)) {
                    url = url.replaceFirst(u.getHost(), host);
                }
            } catch (UnknownHostException e) {
                logger.debug("Cannot resolve IP to host for :" + u.getHost(), e);
            }
        }
        return this;
    }
882248
@Override
	public synchronized void removeHost(Host host) {

        if( log.isDebugEnabled() )
            log.debug("Removing host[" + host.getName() + "]");

        // Is this Host actually among those that are defined?
        boolean found = false;
        for (int i = 0; i < engines.length; i++) {
            Container hosts[] = engines[i].findChildren();
            for (int j = 0; j < hosts.length; j++) {
                if (host == (Host) hosts[j]) {
                    found = true;
                    break;

                }
            }
            if (found)
                break;
        }
        if (!found)
            return;

        // Remove this Host from the associated Engine
        if( log.isDebugEnabled() )
            log.debug(" Removing this Host");
        host.getParent().removeChild(host);

    }
1146556
protected String adjustHost(final String host) {
    if (host.startsWith(HTTP_PROTOCOL)) {
      return host.replace(HTTP_PROTOCOL, EMPTY_STRING);
    } else if (host.startsWith(HTTPS_PROTOCOL)) {
      return host.replace(HTTPS_PROTOCOL, EMPTY_STRING);
    }
    return host;
  }
765434
public final static boolean isValidURL(String url) {
        if (url == null) {
            return false;
        } else {
            return Patterns.WEB_URL.matcher(url).matches();
        }
    }
578352
public void removeConnectionPool(String url) {
        try {
            removeConnectionPool(new URL(url));
        } catch (MalformedURLException e) {
            log.error("url exception", e);
            throw new IllegalArgumentException(e);
        }
    }
461044
public T hostFromUrl(String urlStr) {
        if (StringUtils.isNotBlank(urlStr)) {
            try {
                URL url = new URL(urlStr);
                defaultHost = new HttpHost(url.getHost(), url.getPort(), url.getProtocol());
            } catch (MalformedURLException e) {
                throw new IllegalArgumentException("Cannot parse the url " + urlStr, e);
            }
        } else {
            defaultHost = null;
        }
        return self();
    }