org.apache.hc.client5.http

## Class ContextBuilder

- java.lang.Object
- - org.apache.hc.client5.http.AbstractClientContextBuilder<HttpClientContext>
  - - org.apache.hc.client5.http.ContextBuilder

-     public class ContextBuilder
      extends AbstractClientContextBuilder<HttpClientContext>

  `HttpClientContext` builder.
  Since:
    5.2

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ContextBuilder(SchemePortResolver schemePortResolver)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ContextBuilder` | `create()`
    `static ContextBuilder` | `create(SchemePortResolver schemePortResolver)`
    `protected HttpClientContext` | `createContext()`
    `ContextBuilder` | `preemptiveAuth(org.apache.hc.core5.http.HttpHost host, AuthScheme authScheme)`
    `ContextBuilder` | `preemptiveBasicAuth(org.apache.hc.core5.http.HttpHost host, UsernamePasswordCredentials credentials)`
    `ContextBuilder` | `useAuthCache(AuthCache authCache)`
    `ContextBuilder` | `useAuthSchemeRegistry(org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> authSchemeRegistry)`
    `ContextBuilder` | `useCookieSpecRegistry(org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> cookieSpecRegistry)`
    `ContextBuilder` | `useCookieStore(CookieStore cookieStore)`
    `ContextBuilder` | `useCredentialsProvider(CredentialsProvider credentialsProvider)`

    - ### Methods inherited from class org.apache.hc.client5.http.AbstractClientContextBuilder

      `build`

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

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

- - ### Constructor Detail

    - #### ContextBuilder

          protected ContextBuilder(SchemePortResolver schemePortResolver)

  - ### Method Detail

    - #### create

          public static ContextBuilder create(SchemePortResolver schemePortResolver)

    - #### create

          public static ContextBuilder create()

    - #### useCookieSpecRegistry

          public ContextBuilder useCookieSpecRegistry(org.apache.hc.core5.http.config.Lookup<CookieSpecFactory> cookieSpecRegistry)

      Overrides:
        `useCookieSpecRegistry` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### useAuthSchemeRegistry

          public ContextBuilder useAuthSchemeRegistry(org.apache.hc.core5.http.config.Lookup<AuthSchemeFactory> authSchemeRegistry)

      Overrides:
        `useAuthSchemeRegistry` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### useCookieStore

          public ContextBuilder useCookieStore(CookieStore cookieStore)

      Overrides:
        `useCookieStore` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### useCredentialsProvider

          public ContextBuilder useCredentialsProvider(CredentialsProvider credentialsProvider)

      Overrides:
        `useCredentialsProvider` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### useAuthCache

          public ContextBuilder useAuthCache(AuthCache authCache)

      Overrides:
        `useAuthCache` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### preemptiveAuth

          public ContextBuilder preemptiveAuth(org.apache.hc.core5.http.HttpHost host,
                                               AuthScheme authScheme)

      Overrides:
        `preemptiveAuth` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### preemptiveBasicAuth

          public ContextBuilder preemptiveBasicAuth(org.apache.hc.core5.http.HttpHost host,
                                                    UsernamePasswordCredentials credentials)

      Overrides:
        `preemptiveBasicAuth` in class `AbstractClientContextBuilder<HttpClientContext>`

    - #### createContext

          protected HttpClientContext createContext()

      Specified by:
        `createContext` in class `AbstractClientContextBuilder<HttpClientContext>`

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