Class HttpCacheContext

java.lang.Object
org.apache.hc.core5.http.protocol.HttpCoreContext
org.apache.hc.client5.http.protocol.HttpClientContext
org.apache.hc.client5.http.cache.HttpCacheContext
All Implemented Interfaces:
org.apache.hc.core5.http.protocol.HttpContext
Direct Known Subclasses:
HttpCacheContext.Delegate

public class HttpCacheContext extends HttpClientContext
Cache execution HttpContext. This class can be re-used for multiple consecutive logically related request executions that represent a single communication session. This context may not be used concurrently.

IMPORTANT: This class is NOT thread-safe and MUST NOT be used concurrently by multiple message exchanges.

Since:
4.3
  • Field Details

  • Constructor Details

    • HttpCacheContext

      public HttpCacheContext(org.apache.hc.core5.http.protocol.HttpContext context)
    • HttpCacheContext

      public HttpCacheContext()
  • Method Details

    • adapt

      @Deprecated public static HttpCacheContext adapt(org.apache.hc.core5.http.protocol.HttpContext context)
      Deprecated.
    • cast

      public static HttpCacheContext cast(org.apache.hc.core5.http.protocol.HttpContext context)
      Casts the given generic HttpContext as HttpCacheContext or throws an IllegalStateException if the given context is not suitable.
      Since:
      5.4
    • castOrCreate

      public static HttpCacheContext castOrCreate(org.apache.hc.core5.http.protocol.HttpContext context)
      Casts the given generic HttpContext as HttpCacheContext or creates new HttpCacheContext if the given context is null..
      Since:
      5.4
    • create

      public static HttpCacheContext create()
    • getCacheResponseStatus

      public CacheResponseStatus getCacheResponseStatus()
      Represents an outcome of the cache operation and the way the response has been generated.

      This context attribute is expected to be populated by the protocol handler.

    • setCacheResponseStatus

      @Internal public void setCacheResponseStatus(CacheResponseStatus responseStatus)
      Since:
      5.4
    • getRequestCacheControl

      public RequestCacheControl getRequestCacheControl()
      Represents cache control requested by the client.

      This context attribute is expected to be set by the caller.

      Since:
      5.4
    • getRequestCacheControlOrDefault

      public final RequestCacheControl getRequestCacheControlOrDefault()
      Returns cache control requested by the client or RequestCacheControl.DEFAULT if not explicitly set in the context.
      Since:
      5.4
    • setRequestCacheControl

      @Internal public void setRequestCacheControl(RequestCacheControl requestCacheControl)
      Since:
      5.4
    • getResponseCacheControl

      public ResponseCacheControl getResponseCacheControl()
      Represents cache control enforced by the server.

      This context attribute is expected to be populated by the protocol handler.

      Since:
      5.4
    • getResponseCacheControlOrDefault

      public final ResponseCacheControl getResponseCacheControlOrDefault()
      Represents cache control enforced by the server or ResponseCacheControl.DEFAULT if not explicitly set in the context.
      Since:
      5.4
    • setResponseCacheControl

      @Internal public void setResponseCacheControl(ResponseCacheControl responseCacheControl)
      Since:
      5.4
    • getCacheEntry

      public HttpCacheEntry getCacheEntry()
      Represents the cache entry the resource of which has been used to generate the response.

      This context attribute is expected to be populated by the protocol handler.

      Since:
      5.4
    • setCacheEntry

      @Internal public void setCacheEntry(HttpCacheEntry cacheEntry)
      Since:
      5.4