Removes query parameters from url (only for logging, as query parameters may contain sensible informations)

@param uri
@return URI without parameters
426996
public static String shortenUrl( URI uri )
    {
        return uri.getScheme() + "://" + uri.getHost() + uri.getPath();
    }
448750
private String appendQueryParams(String uri, Map<String, Object> headers) {
        if (!headers.containsKey(QUERY_PARAM_HEADER_NAME)) {
            return uri;
        }

        String requestUri = uri;
        StringBuilder queryParamBuilder = new StringBuilder();
        String queryParams = headers.get(QUERY_PARAM_HEADER_NAME).toString();

        StringTokenizer tok = new StringTokenizer(queryParams, ",");
        if (tok.hasMoreTokens()) {
            while (requestUri.endsWith("/")) {
                requestUri = requestUri.substring(0, requestUri.length() - 1);
            }

            queryParamBuilder.append("?").append(tok.nextToken());
        }

        while (tok.hasMoreTokens()) {
            queryParamBuilder.append("&").append(tok.nextToken());
        }

        return requestUri + queryParamBuilder.toString();
    }
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;
  }
556454
public static RedisURI create(String uri) {
        LettuceAssert.notEmpty(uri, "URI must not be empty");
        return create(URI.create(uri));
    }
389637
public static String getRawQuery(final URI uri, final boolean strict) {
        return esc(strict).escapeQuery(Strings.emptyToNull(uri.getRawQuery()));
    }
135453
protected String toBaseURI(String uri) {
    LoaEnum loa = LoaEnum.parse(uri);
    if (loa != null && loa.isSignatureMessageUri()) {
      return LoaEnum.minusSigMessage(loa).getUri();
    }
    return uri;
  }
586630
public static URI toURI(String strURI){
		try {
			return new URI(strURI.trim());
		}
		catch (Exception e) {
			throw new IllegalArgumentException(e);
		}
	}
705081
public boolean remove(URI uri, HttpCookie ck) {
        // argument can't be null
        if (ck == null) {
            throw new NullPointerException("cookie is null");
        }

        lock.lock();
        try {
            uri = getEffectiveURI(uri);
            if (uriIndex.get(uri) == null) {
                return false;
            } else {
                List<HttpCookie> cookies = uriIndex.get(uri);
                if (cookies != null) {
                    return cookies.remove(ck);
                } else {
                    return false;
                }
            }
        } finally {
            lock.unlock();
        }
    }
493471
public UriComponentsBuilder uri(URI uri) {
		Assert.notNull(uri, "'uri' must not be null");
		this.scheme = uri.getScheme();
		if (uri.isOpaque()) {
			this.ssp = uri.getRawSchemeSpecificPart();
			resetHierarchicalComponents();
		}
		else {
			if (uri.getRawUserInfo() != null) {
				this.userInfo = uri.getRawUserInfo();
			}
			if (uri.getHost() != null) {
				this.host = uri.getHost();
			}
			if (uri.getPort() != -1) {
				this.port = String.valueOf(uri.getPort());
			}
			if (StringUtils.hasLength(uri.getRawPath())) {
				this.pathBuilder = new CompositePathComponentBuilder(uri.getRawPath());
			}
			if (StringUtils.hasLength(uri.getRawQuery())) {
				this.queryParams.clear();
				query(uri.getRawQuery());
			}
			resetSchemeSpecificPart();
		}
		if (uri.getRawFragment() != null) {
			this.fragment = uri.getRawFragment();
		}
		return this;
	}
246266
public static Condition uri(final String uri) {
        return new Condition(input -> input.getUri().equals(uri));
    }
1248229
public static function fromString($uri)
    {
        $parameters = parse_url($uri);

        if (isset($parameters['user'])) {
            $parameters['username'] = $parameters['user'];
        }

        if (isset($parameters['pass'])) {
            $parameters['password'] = $parameters['pass'];
        }

        if (isset($parameters['path']) && strlen($parameters['path']) > 0) {
            list(, $parameters['database']) = explode('/', $parameters['path'], 2);
        }

        unset($parameters['path'], $parameters['user'], $parameters['pass']);

        return self::fromArray($parameters);
    }
1209480
public static SamlEndpoint ofHttpRedirect(String uri) {
        requireNonNull(uri, "uri");
        try {
            return ofHttpRedirect(new URI(uri));
        } catch (URISyntaxException e) {
            return Exceptions.throwUnsafely(e);
        }
    }
1287575
public Traverson startWith(final String uri) {
        startWith = hrefToUrl(uri);
        contextUrl = startWith;
        lastResult = null;
        return this;
    }
464278
public static String getId(URI uri) {
        String s = uri.toString();
        return s.substring(s.lastIndexOf("/") + 1);
    }
1192352
public URI rewriteURI(Request request) throws URISyntaxException {
        String path = request.path();
        if (!path.startsWith(prefix)) {
            return null;
        }

        StringBuilder uri = new StringBuilder(redirectTo);
        if (redirectTo.endsWith("/")) {
            uri.setLength(uri.length() - 1);
        }
        String rest = path.substring(prefix.length());
        if (!rest.startsWith("/") && !rest.isEmpty()) {
            uri.append("/");
        }
        uri.append(rest);

        // Do we have a query String
        int index = request.uri().indexOf("?");
        String query = null;
        if (index != -1) {
            // Remove the ?
            query = request.uri().substring(index + 1);
        }

        if (!Strings.isNullOrEmpty(query)) {
            uri.append("?").append(query);
        }

        return URI.create(uri.toString()).normalize();
    }
713708
public String toUriString(final java.net.URI uri) {
    return this.toUriString(URI.createURI(uri.normalize().toString()));
  }
472306
static Map<String, String> parse(URI uri) {

        Map<String, String> result = new HashMap<String, String>();

        String queryString = uri.getQuery();
        if (queryString == null && uri.getSchemeSpecificPart() != null && uri.getSchemeSpecificPart().contains("?")) {
            queryString = uri.getSchemeSpecificPart().substring(uri.getSchemeSpecificPart().indexOf('?') + 1);
        }

        if (queryString == null) {
            return result;
        }

        StringTokenizer st = new StringTokenizer(queryString, "&;");
        while (st.hasMoreTokens()) {
            String queryParam = st.nextToken();
            int equalsIndex = queryParam.indexOf('=');
            if (equalsIndex != -1) {
                String key = queryParam.substring(0, equalsIndex);
                String value = queryParam.substring(equalsIndex + 1);

                result.put(key.toLowerCase(), value);
            }
        }

        return result;
    }