@Deprecated
    public static URI rewriteURI(final URI uri) throws URISyntaxException {
        Args.notNull(uri, "URI");
        if (uri.isOpaque()) {
            return uri;
        }
        final URIBuilder uribuilder = new URIBuilder(uri);
        if (uribuilder.getUserInfo() != null) {
            uribuilder.setUserInfo(null);
        }
        if (uribuilder.isPathEmpty()) {
            uribuilder.setPathSegments("");
        }
        if (uribuilder.getHost() != null) {
            uribuilder.setHost(uribuilder.getHost().toLowerCase(Locale.ROOT));
        }
        uribuilder.setFragment(null);
        return uribuilder.build();
    }
A convenience method that creates a new {@link URI} whose scheme, host, port, path,
query are taken from the existing URI, dropping any fragment or user-information.
The path is set to "/" if not explicitly specified. The existing URI is returned
unmodified if it has no fragment or user-information and has a path.

@param uri
           original URI.
@throws URISyntaxException
            If the resulting URI is invalid.

@deprecated Use {@link URIBuilder}.
httpclient5/src/main/java/org/apache/hc/client5/http/utils/URIUtils.java