public class HttpClientContext
extends org.apache.hc.core5.http.protocol.HttpCoreContext
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 |
AUTH_CACHE
Deprecated.
Use getter methods
|
static String |
AUTH_EXCHANGE_MAP
Deprecated.
Use getter methods
|
static String |
AUTHSCHEME_REGISTRY
Deprecated.
Use getter methods
|
static String |
COOKIE_ORIGIN
Deprecated.
Use getter methods
|
static String |
COOKIE_SPEC
Deprecated.
Use getter methods
|
static String |
COOKIE_STORE
Deprecated.
Use getter methods
|
static String |
COOKIESPEC_REGISTRY
Deprecated.
Use getter methods
|
static String |
CREDS_PROVIDER
Deprecated.
Use getter methods
|
static String |
EXCHANGE_ID
Deprecated.
Use getter methods
|
static String |
HTTP_ROUTE
Deprecated.
Use getter methods
|
static String |
REDIRECT_LOCATIONS
Deprecated.
Use getter methods
|
static String |
REQUEST_CONFIG
Deprecated.
Use getter methods
|
static String |
USER_TOKEN
Deprecated.
Use getter methods
|
Constructor and Description |
---|
HttpClientContext() |
HttpClientContext(org.apache.hc.core5.http.protocol.HttpContext context) |
Modifier and Type | Method and Description |
---|---|
static HttpClientContext |
adapt(org.apache.hc.core5.http.protocol.HttpContext context)
Deprecated.
|
static HttpClientContext |
cast(org.apache.hc.core5.http.protocol.HttpContext context)
Casts the given generic
HttpContext as HttpClientContext or
throws an IllegalStateException if the given context is not suitable. |
static HttpClientContext |
castOrCreate(org.apache.hc.core5.http.protocol.HttpContext context)
Casts the given generic
HttpContext as HttpClientContext or
creates new HttpClientContext if the given context is null.. |
static HttpClientContext |
create() |
AuthCache |
getAuthCache()
Represents a
AuthCache used in the context of the request execution. |
AuthExchange |
getAuthExchange(org.apache.hc.core5.http.HttpHost host) |
Map<org.apache.hc.core5.http.HttpHost,AuthExchange> |
getAuthExchanges()
Represents a map of
AuthExchange s performed in the context of the request
execution. |
org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> |
getAuthSchemeRegistry()
Represents a
AuthSchemeFactory registry used in the context of the request execution. |
CookieOrigin |
getCookieOrigin()
Represents a
CookieOrigin produced in the context of request execution. |
CookieSpec |
getCookieSpec()
Represents a
CookieSpec chosen in the context of request execution. |
org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> |
getCookieSpecRegistry()
Represents a
CookieSpecFactory registry used in the context of the request execution. |
CookieStore |
getCookieStore()
Represents a
CookieStore used in the context of the request execution. |
CredentialsProvider |
getCredentialsProvider()
Represents a
CredentialsProvider registry used in the context of the request execution. |
String |
getExchangeId()
Represents an identifier generated for the current message exchange executed
in the given context.
|
RouteInfo |
getHttpRoute()
Represents current route used to execute message exchanges.
|
RedirectLocations |
getRedirectLocations()
Represents a collection of all redirects executed in the context of request execution.
|
RequestConfig |
getRequestConfig()
Represents an
used in the context of the request execution. |
RequestConfig |
getRequestConfigOrDefault()
Returns
RequestConfig set in the context or RequestConfig.DEFAULT
if not explicitly set in the context. |
Object |
getUserToken()
Represents an arbitrary user token that identifies the user in the context
of the request execution.
|
<T> T |
getUserToken(Class<T> clazz)
Deprecated.
Use
getUserToken() |
void |
resetAuthExchange(org.apache.hc.core5.http.HttpHost host,
AuthScheme authScheme) |
void |
setAuthCache(AuthCache authCache) |
void |
setAuthExchange(org.apache.hc.core5.http.HttpHost host,
AuthExchange authExchange) |
void |
setAuthSchemeRegistry(org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> lookup) |
void |
setCookieOrigin(CookieOrigin cookieOrigin) |
void |
setCookieSpec(CookieSpec cookieSpec) |
void |
setCookieSpecRegistry(org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> lookup) |
void |
setCookieStore(CookieStore cookieStore) |
void |
setCredentialsProvider(CredentialsProvider credentialsProvider) |
void |
setExchangeId(String exchangeId) |
void |
setRedirectLocations(RedirectLocations redirectLocations) |
void |
setRequestConfig(RequestConfig requestConfig) |
void |
setRoute(HttpRoute route) |
void |
setUserToken(Object userToken) |
getAttribute, getAttribute, getEndpointDetails, getProtocolVersion, getRequest, getResponse, getSSLSession, removeAttribute, setAttribute, setEndpointDetails, setProtocolVersion, setRequest, setResponse, setSSLSession, toString
@Deprecated public static final String HTTP_ROUTE
@Deprecated public static final String REDIRECT_LOCATIONS
@Deprecated public static final String COOKIESPEC_REGISTRY
@Deprecated public static final String COOKIE_SPEC
@Deprecated public static final String COOKIE_ORIGIN
@Deprecated public static final String COOKIE_STORE
@Deprecated public static final String CREDS_PROVIDER
@Deprecated public static final String AUTH_CACHE
@Deprecated public static final String AUTH_EXCHANGE_MAP
@Deprecated public static final String USER_TOKEN
@Deprecated public static final String AUTHSCHEME_REGISTRY
@Deprecated public static final String REQUEST_CONFIG
@Deprecated public static final String EXCHANGE_ID
public HttpClientContext(org.apache.hc.core5.http.protocol.HttpContext context)
public HttpClientContext()
@Deprecated public static HttpClientContext adapt(org.apache.hc.core5.http.protocol.HttpContext context)
castOrCreate(HttpContext)
.public static HttpClientContext cast(org.apache.hc.core5.http.protocol.HttpContext context)
HttpContext
as HttpClientContext
or
throws an IllegalStateException
if the given context is not suitable.public static HttpClientContext castOrCreate(org.apache.hc.core5.http.protocol.HttpContext context)
HttpContext
as HttpClientContext
or
creates new HttpClientContext
if the given context is null..public static HttpClientContext create()
public RouteInfo getHttpRoute()
This context attribute is expected to be populated by the protocol handler.
@Internal public void setRoute(HttpRoute route)
public RedirectLocations getRedirectLocations()
This context attribute is expected to be populated by the protocol handler.
@Internal public void setRedirectLocations(RedirectLocations redirectLocations)
public CookieStore getCookieStore()
CookieStore
used in the context of the request execution.
This context attribute can be set by the caller.
public void setCookieStore(CookieStore cookieStore)
public CookieSpec getCookieSpec()
CookieSpec
chosen in the context of request execution.
This context attribute is expected to be populated by the protocol handler.
@Internal public void setCookieSpec(CookieSpec cookieSpec)
public CookieOrigin getCookieOrigin()
CookieOrigin
produced in the context of request execution.
This context attribute is expected to be populated by the protocol handler.
@Internal public void setCookieOrigin(CookieOrigin cookieOrigin)
public org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> getCookieSpecRegistry()
CookieSpecFactory
registry used in the context of the request execution.
This context attribute can be set by the caller.
public void setCookieSpecRegistry(org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> lookup)
public org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> getAuthSchemeRegistry()
AuthSchemeFactory
registry used in the context of the request execution.
This context attribute can be set by the caller.
public void setAuthSchemeRegistry(org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> lookup)
public CredentialsProvider getCredentialsProvider()
CredentialsProvider
registry used in the context of the request execution.
This context attribute can be set by the caller.
public void setCredentialsProvider(CredentialsProvider credentialsProvider)
public AuthCache getAuthCache()
AuthCache
used in the context of the request execution.
This context attribute can be set by the caller.
public void setAuthCache(AuthCache authCache)
public Map<org.apache.hc.core5.http.HttpHost,AuthExchange> getAuthExchanges()
AuthExchange
s performed in the context of the request
execution.
This context attribute is expected to be populated by the protocol handler.
public AuthExchange getAuthExchange(org.apache.hc.core5.http.HttpHost host)
public void setAuthExchange(org.apache.hc.core5.http.HttpHost host, AuthExchange authExchange)
public void resetAuthExchange(org.apache.hc.core5.http.HttpHost host, AuthScheme authScheme)
@Deprecated public <T> T getUserToken(Class<T> clazz)
getUserToken()
public Object getUserToken()
This context attribute can be set by the caller.
public void setUserToken(Object userToken)
public RequestConfig getRequestConfig()
used
in the context of the request execution.
This context attribute can be set by the caller.
public final RequestConfig getRequestConfigOrDefault()
RequestConfig
set in the context or RequestConfig.DEFAULT
if not explicitly set in the context.public void setRequestConfig(RequestConfig requestConfig)
public String getExchangeId()
This context attribute is expected to be populated by the protocol handler.
public void setExchangeId(String exchangeId)
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.