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
`protected` `ContextBuilder(SchemePortResolver schemePortResolver)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static ContextBuilder` `create()`
`static ContextBuilder` `create(SchemePortResolver schemePortResolver)`
`protected HttpClientContext` `createContext()`
`ContextBuilder` `preemptiveAuth(HttpHost host, AuthScheme authScheme)`
`ContextBuilder` `preemptiveBasicAuth(HttpHost host, UsernamePasswordCredentials credentials)`
`ContextBuilder` `useAuthCache(AuthCache authCache)`
`ContextBuilder` `useAuthSchemeRegistry(Lookup<AuthSchemeFactory> authSchemeRegistry)`
`ContextBuilder` `useCookieSpecRegistry(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(Lookup<CookieSpecFactory> cookieSpecRegistry)

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

#### useAuthSchemeRegistry

    public ContextBuilder useAuthSchemeRegistry(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(HttpHost host,
                                         AuthScheme authScheme)

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

#### preemptiveBasicAuth

    public ContextBuilder preemptiveBasicAuth(HttpHost host,
                                              UsernamePasswordCredentials credentials)

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

#### createContext

    protected HttpClientContext createContext()

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