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
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classInternal adaptor class that delegates all its method calls toHttpClientContext. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Stringstatic final StringDeprecated.Use getter methodsprivate HttpCacheEntry(package private) static final Stringprivate RequestCacheControl(package private) static final Stringprivate ResponseCacheControlprivate CacheResponseStatusFields inherited from class 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_TOKENFields inherited from class org.apache.hc.core5.http.protocol.HttpCoreContext
CONNECTION_ENDPOINT, HTTP_REQUEST, HTTP_RESPONSE, SSL_SESSIONFields inherited from interface org.apache.hc.core5.http.protocol.HttpContext
RESERVED_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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()Represents the cache entry the resource of which has been used to generate the response.Represents an outcome of the cache operation and the way the response has been generated.Represents cache control requested by the client.final RequestCacheControlReturns cache control requested by the client orRequestCacheControl.DEFAULTif not explicitly set in the context.Represents cache control enforced by the server.final ResponseCacheControlRepresents 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 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, setUserTokenMethods 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 Details
-
CACHE_RESPONSE_STATUS
Deprecated.Use getter methods- See Also:
-
REQUEST_CACHE_CONTROL
- See Also:
-
RESPONSE_CACHE_CONTROL
- See Also:
-
CACHE_ENTRY
- See Also:
-
responseStatus
-
requestCacheControl
-
responseCacheControl
-
cacheEntry
-
-
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
Casts the given genericHttpContextasHttpCacheContextor throws anIllegalStateExceptionif the given context is not suitable.- Since:
- 5.4
-
castOrCreate
Casts the given genericHttpContextasHttpCacheContextor creates newHttpCacheContextif the given context is null..- Since:
- 5.4
-
create
-
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
- Since:
- 5.4
-
getRequestCacheControl
Represents cache control requested by the client.This context attribute is expected to be set by the caller.
- Since:
- 5.4
-
getRequestCacheControlOrDefault
Returns cache control requested by the client orRequestCacheControl.DEFAULTif not explicitly set in the context.- Since:
- 5.4
-
setRequestCacheControl
- Since:
- 5.4
-
getResponseCacheControl
Represents cache control enforced by the server.This context attribute is expected to be populated by the protocol handler.
- Since:
- 5.4
-
getResponseCacheControlOrDefault
Represents cache control enforced by the server orResponseCacheControl.DEFAULTif not explicitly set in the context.- Since:
- 5.4
-
setResponseCacheControl
- Since:
- 5.4
-
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
- Since:
- 5.4
-