Package org.apache.hc.client5.http.cache
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 executionHttpContext. 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classHttpCacheContext.DelegateInternal adaptor class that delegates all its method calls toHttpClientContext.
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringCACHE_ENTRYstatic java.lang.StringCACHE_RESPONSE_STATUSDeprecated.Use getter methodsprivate HttpCacheEntrycacheEntry(package private) static java.lang.StringREQUEST_CACHE_CONTROLprivate RequestCacheControlrequestCacheControl(package private) static java.lang.StringRESPONSE_CACHE_CONTROLprivate ResponseCacheControlresponseCacheControlprivate CacheResponseStatusresponseStatus-
Fields inherited from class org.apache.hc.client5.http.protocol.HttpClientContext
AUTH_CACHE, AUTH_EXCHANGE_MAP, AUTHSCHEME_REGISTRY, COOKIE_ORIGIN, COOKIE_SPEC, COOKIE_STORE, COOKIESPEC_REGISTRY, CREDS_PROVIDER, EXCHANGE_ID, HTTP_ROUTE, REDIRECT_LOCATIONS, REQUEST_CONFIG, USER_TOKEN
-
-
Constructor Summary
Constructors Constructor Description HttpCacheContext()HttpCacheContext(org.apache.hc.core5.http.protocol.HttpContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static HttpCacheContextadapt(org.apache.hc.core5.http.protocol.HttpContext context)Deprecated.static HttpCacheContextcast(org.apache.hc.core5.http.protocol.HttpContext context)Casts the given genericHttpContextasHttpCacheContextor throws anIllegalStateExceptionif the given context is not suitable.static HttpCacheContextcastOrCreate(org.apache.hc.core5.http.protocol.HttpContext context)Casts the given genericHttpContextasHttpCacheContextor creates newHttpCacheContextif the given context is null..static HttpCacheContextcreate()HttpCacheEntrygetCacheEntry()Represents the cache entry the resource of which has been used to generate the response.CacheResponseStatusgetCacheResponseStatus()Represents an outcome of the cache operation and the way the response has been generated.RequestCacheControlgetRequestCacheControl()Represents cache control requested by the client.RequestCacheControlgetRequestCacheControlOrDefault()Returns cache control requested by the client orRequestCacheControl.DEFAULTif not explicitly set in the context.ResponseCacheControlgetResponseCacheControl()Represents cache control enforced by the server.ResponseCacheControlgetResponseCacheControlOrDefault()Represents cache control enforced by the server orResponseCacheControl.DEFAULTif not explicitly set in the context.voidsetCacheEntry(HttpCacheEntry cacheEntry)voidsetCacheResponseStatus(CacheResponseStatus responseStatus)voidsetRequestCacheControl(RequestCacheControl requestCacheControl)voidsetResponseCacheControl(ResponseCacheControl responseCacheControl)-
Methods inherited from class org.apache.hc.client5.http.protocol.HttpClientContext
getAuthCache, getAuthExchange, getAuthExchanges, getAuthSchemeRegistry, getCookieOrigin, getCookieSpec, getCookieSpecRegistry, getCookieStore, getCredentialsProvider, getExchangeId, getHttpRoute, getNextNonce, getRedirectLocations, getRequestConfig, getRequestConfigOrDefault, getUserToken, getUserToken, resetAuthExchange, setAuthCache, setAuthExchange, setAuthSchemeRegistry, setCookieOrigin, setCookieSpec, setCookieSpecRegistry, setCookieStore, setCredentialsProvider, setExchangeId, setNextNonce, setRedirectLocations, setRequestConfig, setRoute, setUserToken
-
Methods inherited from class org.apache.hc.core5.http.protocol.HttpCoreContext
getAttribute, getAttribute, getEndpointDetails, getProtocolVersion, getRequest, getResponse, getSSLSession, removeAttribute, setAttribute, setEndpointDetails, setProtocolVersion, setRequest, setResponse, setSSLSession, toString
-
-
-
-
Field Detail
-
CACHE_RESPONSE_STATUS
@Deprecated public static final java.lang.String CACHE_RESPONSE_STATUS
Deprecated.Use getter methods- See Also:
- Constant Field Values
-
REQUEST_CACHE_CONTROL
static final java.lang.String REQUEST_CACHE_CONTROL
- See Also:
- Constant Field Values
-
RESPONSE_CACHE_CONTROL
static final java.lang.String RESPONSE_CACHE_CONTROL
- See Also:
- Constant Field Values
-
CACHE_ENTRY
static final java.lang.String CACHE_ENTRY
- See Also:
- Constant Field Values
-
responseStatus
private CacheResponseStatus responseStatus
-
requestCacheControl
private RequestCacheControl requestCacheControl
-
responseCacheControl
private ResponseCacheControl responseCacheControl
-
cacheEntry
private HttpCacheEntry cacheEntry
-
-
Method Detail
-
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 genericHttpContextasHttpCacheContextor throws anIllegalStateExceptionif 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 genericHttpContextasHttpCacheContextor creates newHttpCacheContextif 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 orRequestCacheControl.DEFAULTif 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 orResponseCacheControl.DEFAULTif 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
-
-