org.apache.hc.client5.http.protocol

## Class HttpClientContext

- java.lang.Object
- - org.apache.hc.core5.http.protocol.HttpCoreContext
  - - org.apache.hc.client5.http.protocol.HttpClientContext

- All Implemented Interfaces:
    HttpContext
  Direct Known Subclasses:
    HttpCacheContext

      public class HttpClientContext
      extends HttpCoreContext

  Adaptor class that provides convenience type safe setters and getters for common `HttpContext` attributes used in the course of HTTP request execution.
  Since:
    4.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `AUTH_CACHE` Attribute name of a `AuthCache` object that represents the auth scheme cache.
    `static String` | `AUTH_EXCHANGE_MAP` Attribute name of a map containing actual `AuthExchange`s keyed by their respective `HttpHost`.
    `static String` | `AUTHSCHEME_REGISTRY` Attribute name of a `Lookup` object that represents the actual `AuthSchemeFactory` registry.
    `static String` | `COOKIE_ORIGIN` Attribute name of a `CookieOrigin` object that represents the actual details of the origin server.
    `static String` | `COOKIE_SPEC` Attribute name of a `CookieSpec` object that represents the actual cookie specification.
    `static String` | `COOKIE_STORE` Attribute name of a `CookieStore` object that represents the actual cookie store.
    `static String` | `COOKIESPEC_REGISTRY` Attribute name of a `Lookup` object that represents the actual `CookieSpecFactory` registry.
    `static String` | `CREDS_PROVIDER` Attribute name of a `CredentialsProvider` object that represents the actual credentials provider.
    `static String` | `EXCHANGE_ID` Attribute name of a `String` object that represents the ID of the current message exchange.
    `static String` | `HTTP_ROUTE` Attribute name of a `RouteInfo` object that represents the actual connection route.
    `static String` | `REDIRECT_LOCATIONS` Attribute name of a `RedirectLocations` object that represents a collection of all redirect locations received in the process of request execution.
    `static String` | `REQUEST_CONFIG` Attribute name of a `RequestConfig` object that represents the actual request configuration.
    `static String` | `USER_TOKEN` Attribute name of a `Object` object that represents the actual user identity such as user `Principal`.

    - ### Fields inherited from class org.apache.hc.core5.http.protocol.HttpCoreContext

      `CONNECTION_ENDPOINT, HTTP_REQUEST, HTTP_RESPONSE, SSL_SESSION`

    - ### Fields inherited from interface org.apache.hc.core5.http.protocol.HttpContext

      `RESERVED_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpClientContext()`
    `HttpClientContext(HttpContext context)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static HttpClientContext` | `adapt(HttpContext context)`
    `static HttpClientContext` | `create()`
    `AuthCache` | `getAuthCache()`
    `AuthExchange` | `getAuthExchange(HttpHost host)`
    `Map<HttpHost,AuthExchange>` | `getAuthExchanges()`
    `Lookup<AuthSchemeFactory>` | `getAuthSchemeRegistry()`
    `CookieOrigin` | `getCookieOrigin()`
    `CookieSpec` | `getCookieSpec()`
    `Lookup<CookieSpecFactory>` | `getCookieSpecRegistry()`
    `CookieStore` | `getCookieStore()`
    `CredentialsProvider` | `getCredentialsProvider()`
    `String` | `getExchangeId()`
    `RouteInfo` | `getHttpRoute()`
    `RedirectLocations` | `getRedirectLocations()`
    `RequestConfig` | `getRequestConfig()`
    `Object` | `getUserToken()`
    `<T> T` | `getUserToken(Class<T> clazz)`
    `void` | `resetAuthExchange(HttpHost host, AuthScheme authScheme)`
    `void` | `setAuthCache(AuthCache authCache)`
    `void` | `setAuthExchange(HttpHost host, AuthExchange authExchange)`
    `void` | `setAuthSchemeRegistry(Lookup<AuthSchemeFactory> lookup)`
    `void` | `setCookieSpecRegistry(Lookup<CookieSpecFactory> lookup)`
    `void` | `setCookieStore(CookieStore cookieStore)`
    `void` | `setCredentialsProvider(CredentialsProvider credentialsProvider)`
    `void` | `setExchangeId(String id)`
    `void` | `setRequestConfig(RequestConfig config)`
    `void` | `setUserToken(Object obj)`

    - ### Methods inherited from class org.apache.hc.core5.http.protocol.HttpCoreContext

      `getAttribute, getAttribute, getEndpointDetails, getProtocolVersion, getRequest, getResponse, getSSLSession, removeAttribute, setAttribute, setProtocolVersion, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### HTTP_ROUTE

          public static final String HTTP_ROUTE

      Attribute name of a `RouteInfo` object that represents the actual connection route.
      See Also:
        Constant Field Values

    - #### REDIRECT_LOCATIONS

          public static final String REDIRECT_LOCATIONS

      Attribute name of a `RedirectLocations` object that represents a collection of all redirect locations received in the process of request execution.
      See Also:
        Constant Field Values

    - #### COOKIESPEC_REGISTRY

          public static final String COOKIESPEC_REGISTRY

      Attribute name of a `Lookup` object that represents the actual `CookieSpecFactory` registry.
      See Also:
        Constant Field Values

    - #### COOKIE_SPEC

          public static final String COOKIE_SPEC

      Attribute name of a `CookieSpec` object that represents the actual cookie specification.
      See Also:
        Constant Field Values

    - #### COOKIE_ORIGIN

          public static final String COOKIE_ORIGIN

      Attribute name of a `CookieOrigin` object that represents the actual details of the origin server.
      See Also:
        Constant Field Values

    - #### COOKIE_STORE

          public static final String COOKIE_STORE

      Attribute name of a `CookieStore` object that represents the actual cookie store.
      See Also:
        Constant Field Values

    - #### CREDS_PROVIDER

          public static final String CREDS_PROVIDER

      Attribute name of a `CredentialsProvider` object that represents the actual credentials provider.
      See Also:
        Constant Field Values

    - #### AUTH_CACHE

          public static final String AUTH_CACHE

      Attribute name of a `AuthCache` object that represents the auth scheme cache.
      See Also:
        Constant Field Values

    - #### AUTH_EXCHANGE_MAP

          public static final String AUTH_EXCHANGE_MAP

      Attribute name of a map containing actual `AuthExchange`s keyed by their respective `HttpHost`.
      See Also:
        Constant Field Values

    - #### USER_TOKEN

          public static final String USER_TOKEN

      Attribute name of a `Object` object that represents the actual user identity such as user `Principal`.
      See Also:
        Constant Field Values

    - #### AUTHSCHEME_REGISTRY

          public static final String AUTHSCHEME_REGISTRY

      Attribute name of a `Lookup` object that represents the actual `AuthSchemeFactory` registry.
      See Also:
        Constant Field Values

    - #### REQUEST_CONFIG

          public static final String REQUEST_CONFIG

      Attribute name of a `RequestConfig` object that represents the actual request configuration.
      See Also:
        Constant Field Values

    - #### EXCHANGE_ID

          public static final String EXCHANGE_ID

      Attribute name of a `String` object that represents the ID of the current message exchange.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HttpClientContext

          public HttpClientContext(HttpContext context)

    - #### HttpClientContext

          public HttpClientContext()

  - ### Method Detail

    - #### adapt

          public static HttpClientContext adapt(HttpContext context)

    - #### create

          public static HttpClientContext create()

    - #### getHttpRoute

          public RouteInfo getHttpRoute()

    - #### getRedirectLocations

          public RedirectLocations getRedirectLocations()

    - #### getCookieStore

          public CookieStore getCookieStore()

    - #### setCookieStore

          public void setCookieStore(CookieStore cookieStore)

    - #### getCookieSpec

          public CookieSpec getCookieSpec()

    - #### getCookieOrigin

          public CookieOrigin getCookieOrigin()

    - #### getCookieSpecRegistry

          public Lookup<CookieSpecFactory> getCookieSpecRegistry()

    - #### setCookieSpecRegistry

          public void setCookieSpecRegistry(Lookup<CookieSpecFactory> lookup)

    - #### getAuthSchemeRegistry

          public Lookup<AuthSchemeFactory> getAuthSchemeRegistry()

    - #### setAuthSchemeRegistry

          public void setAuthSchemeRegistry(Lookup<AuthSchemeFactory> lookup)

    - #### getCredentialsProvider

          public CredentialsProvider getCredentialsProvider()

    - #### setCredentialsProvider

          public void setCredentialsProvider(CredentialsProvider credentialsProvider)

    - #### getAuthCache

          public AuthCache getAuthCache()

    - #### setAuthCache

          public void setAuthCache(AuthCache authCache)

    - #### getAuthExchanges

          public Map<HttpHost,AuthExchange> getAuthExchanges()

      Since:
        5.0

    - #### getAuthExchange

          public AuthExchange getAuthExchange(HttpHost host)

      Since:
        5.0

    - #### setAuthExchange

          public void setAuthExchange(HttpHost host,
                                      AuthExchange authExchange)

      Since:
        5.0

    - #### resetAuthExchange

          public void resetAuthExchange(HttpHost host,
                                        AuthScheme authScheme)

      Since:
        5.0

    - #### getUserToken

          public <T> T getUserToken(Class<T> clazz)

    - #### getUserToken

          public Object getUserToken()

    - #### setUserToken

          public void setUserToken(Object obj)

    - #### getRequestConfig

          public RequestConfig getRequestConfig()

    - #### setRequestConfig

          public void setRequestConfig(RequestConfig config)

    - #### getExchangeId

          public String getExchangeId()

      Since:
        5.1

    - #### setExchangeId

          public void setExchangeId(String id)

      Since:
        5.1

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.