org.apache.hc.client5.http.impl.cache

## Class HttpCacheSupport

- java.lang.Object
- - org.apache.hc.client5.http.impl.cache.HttpCacheSupport

-     public final class HttpCacheSupport
      extends Object

  HTTP cache support utilities.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpCacheSupport()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getRequestUri(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpHost target)` Returns text representation of the request URI of the given `HttpRequest`.
    `static URI` | `normalize(URI requestUri)` Returns normalized representation of the request URI optimized for use as a cache key.
    `static URI` | `normalizeQuetly(String requestUri)` Deprecated. Use `normalizeQuietly(String)`
    `static URI` | `normalizeQuietly(String requestUri)` Lenient URI parser that normalizes valid `URI`s and returns `null` for malformed URIs.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpCacheSupport

          public HttpCacheSupport()

  - ### Method Detail

    - #### getRequestUri

          public static String getRequestUri(org.apache.hc.core5.http.HttpRequest request,
                                             org.apache.hc.core5.http.HttpHost target)

      Returns text representation of the request URI of the given `HttpRequest`. This method will use `HttpRequest.getPath()`, `HttpRequest.getScheme()` and `HttpRequest.getAuthority()` values when available or attributes of target `HttpHost` in order to construct an absolute URI.

      This method will not attempt to ensure validity of the resultant text representation.

      Parameters:
        `request` - the `HttpRequest`
        `target` - target host
      Returns:
        String the request URI

    - #### normalize

          public static URI normalize(URI requestUri)
                               throws URISyntaxException

      Returns normalized representation of the request URI optimized for use as a cache key. This method ensures the resultant URI has an explicit port in the authority component, and explicit path component and no fragment.
      Parameters:
        `requestUri` - original request URI
      Returns:
        normalized URI.
      Throws:
        `URISyntaxException`

    - #### normalizeQuetly

          @Deprecated
          public static URI normalizeQuetly(String requestUri)

      Deprecated. Use `normalizeQuietly(String)`
      Lenient URI parser that normalizes valid `URI`s and returns `null` for malformed URIs.

    - #### normalizeQuietly

          public static URI normalizeQuietly(String requestUri)

      Lenient URI parser that normalizes valid `URI`s and returns `null` for malformed URIs.
      Since:
        5.2

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.