public class HttpCacheContext extends HttpClientContext
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.
Modifier and Type | Field and Description |
---|---|
static String |
CACHE_RESPONSE_STATUS
Deprecated.
Use getter methods
|
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 and Description |
---|
HttpCacheContext() |
HttpCacheContext(org.apache.hc.core5.http.protocol.HttpContext context) |
Modifier and Type | Method and Description |
---|---|
static HttpCacheContext |
adapt(org.apache.hc.core5.http.protocol.HttpContext context)
Deprecated.
|
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. |
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.. |
static HttpCacheContext |
create() |
HttpCacheEntry |
getCacheEntry()
Represents the cache entry the resource of which has been used to generate the response.
|
CacheResponseStatus |
getCacheResponseStatus()
Represents an outcome of the cache operation and the way the response has been
generated.
|
RequestCacheControl |
getRequestCacheControl()
Represents cache control requested by the client.
|
RequestCacheControl |
getRequestCacheControlOrDefault()
Returns cache control requested by the client or
RequestCacheControl.DEFAULT
if not explicitly set in the context. |
ResponseCacheControl |
getResponseCacheControl()
Represents cache control enforced by the server.
|
ResponseCacheControl |
getResponseCacheControlOrDefault()
Represents cache control enforced by the server or
ResponseCacheControl.DEFAULT
if not explicitly set in the context. |
void |
setCacheEntry(HttpCacheEntry cacheEntry) |
void |
setCacheResponseStatus(CacheResponseStatus responseStatus) |
void |
setRequestCacheControl(RequestCacheControl requestCacheControl) |
void |
setResponseCacheControl(ResponseCacheControl responseCacheControl) |
getAuthCache, getAuthExchange, getAuthExchanges, getAuthSchemeRegistry, getCookieOrigin, getCookieSpec, getCookieSpecRegistry, getCookieStore, getCredentialsProvider, getExchangeId, getHttpRoute, getRedirectLocations, getRequestConfig, getRequestConfigOrDefault, getUserToken, getUserToken, resetAuthExchange, setAuthCache, setAuthExchange, setAuthSchemeRegistry, setCookieOrigin, setCookieSpec, setCookieSpecRegistry, setCookieStore, setCredentialsProvider, setExchangeId, setRedirectLocations, setRequestConfig, setRoute, setUserToken
getAttribute, getAttribute, getEndpointDetails, getProtocolVersion, getRequest, getResponse, getSSLSession, removeAttribute, setAttribute, setEndpointDetails, setProtocolVersion, setRequest, setResponse, setSSLSession, toString
@Deprecated public static final String CACHE_RESPONSE_STATUS
public HttpCacheContext(org.apache.hc.core5.http.protocol.HttpContext context)
public HttpCacheContext()
@Deprecated public static HttpCacheContext adapt(org.apache.hc.core5.http.protocol.HttpContext context)
castOrCreate(HttpContext)
.public static HttpCacheContext cast(org.apache.hc.core5.http.protocol.HttpContext context)
HttpContext
as HttpCacheContext
or
throws an IllegalStateException
if the given context is not suitable.public static HttpCacheContext castOrCreate(org.apache.hc.core5.http.protocol.HttpContext context)
HttpContext
as HttpCacheContext
or
creates new HttpCacheContext
if the given context is null..public static HttpCacheContext create()
public CacheResponseStatus getCacheResponseStatus()
This context attribute is expected to be populated by the protocol handler.
@Internal public void setCacheResponseStatus(CacheResponseStatus responseStatus)
public RequestCacheControl getRequestCacheControl()
This context attribute is expected to be set by the caller.
public final RequestCacheControl getRequestCacheControlOrDefault()
RequestCacheControl.DEFAULT
if not explicitly set in the context.@Internal public void setRequestCacheControl(RequestCacheControl requestCacheControl)
public ResponseCacheControl getResponseCacheControl()
This context attribute is expected to be populated by the protocol handler.
public final ResponseCacheControl getResponseCacheControlOrDefault()
ResponseCacheControl.DEFAULT
if not explicitly set in the context.@Internal public void setResponseCacheControl(ResponseCacheControl responseCacheControl)
public HttpCacheEntry getCacheEntry()
This context attribute is expected to be populated by the protocol handler.
@Internal public void setCacheEntry(HttpCacheEntry cacheEntry)
Copyright © 2010–2021 The Apache Software Foundation. All rights reserved.