@Internal
    public static String getRequestUri(final HttpHost target, final HttpRequest request) {
        Args.notNull(target, "Target");
        Args.notNull(request, "HTTP request");
        final StringBuilder buf = new StringBuilder();
        final URIAuthority authority = request.getAuthority();
        if (authority != null) {
            final String scheme = request.getScheme();
            buf.append(scheme != null ? scheme : URIScheme.HTTP.id).append("://");
            buf.append(authority.getHostName());
            if (authority.getPort() >= 0) {
                buf.append(":").append(authority.getPort());
            }
        } else {
            buf.append(target.getSchemeName()).append("://");
            buf.append(target.getHostName());
            if (target.getPort() >= 0) {
                buf.append(":").append(target.getPort());
            }
        }
        final String path = request.getPath();
        if (path == null) {
            buf.append("/");
        } else {
            if (buf.length() > 0 && !path.startsWith("/")) {
                buf.append("/");
            }
            buf.append(path);
        }
        return buf.toString();
    }
Returns text representation of the request URI of the given {@link HttpRequest}.
This method will use {@link HttpRequest#getPath()}, {@link HttpRequest#getScheme()} and
{@link HttpRequest#getAuthority()} values when available or attributes of target
{@link HttpHost } in order to construct an absolute URI.
<p>
This method will not attempt to ensure validity of the resultant text representation.

@param target target host
@param request the {@link HttpRequest}

@return String the request URI
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheKeyGenerator.java