Class 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
    • Constructor Detail

      • HttpCacheContext

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

        public HttpCacheContext()
    • Method Detail

      • 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
      • 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
      • 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
      • 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