APIdia Launch Partner
Top Fields Constructors Methods
jdk.internal.net.http

public Class HttpClientBuilderImpl

extends Object
implements Builder
Class Inheritance
All Implemented Interfaces
java.net.http.HttpClient.Builder
Imports
java.net.Authenticator, .CookieHandler, .InetAddress, .ProxySelector, java.time.Duration, java.util.concurrent.Executor, javax.net.ssl.SSLContext, .SSLParameters, java.net.http.HttpClient, jdk.internal.net.http.common.Utils

Field Summary

Modifier and TypeField and Description
pack-priv Authenticator
pack-priv Duration
pack-priv CookieHandler
pack-priv Executor
pack-priv HttpClient.Redirect
pack-priv InetAddress
pack-priv int
pack-priv ProxySelector
pack-priv SSLContext
pack-priv SSLParameters
pack-priv HttpClient.Version

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public HttpClientBuilderImpl
authenticator(Authenticator a)

Implements java.net.http.HttpClient.Builder.authenticator.

Sets an authenticator to use for HTTP authentication.

public HttpClient
build()

Implements java.net.http.HttpClient.Builder.build.

Returns a new HttpClient built from the current state of this builder.

public HttpClientBuilderImpl
connectTimeout(Duration duration)

Implements java.net.http.HttpClient.Builder.connectTimeout.

Sets the connect timeout duration for this client.

public HttpClientBuilderImpl
cookieHandler(CookieHandler cookieHandler)

Implements java.net.http.HttpClient.Builder.cookieHandler.

Sets a cookie handler.

public HttpClientBuilderImpl
executor(Executor s)

Implements java.net.http.HttpClient.Builder.executor.

Sets the executor to be used for asynchronous and dependent tasks.

public HttpClientBuilderImpl
followRedirects(HttpClient.Redirect policy)

Implements java.net.http.HttpClient.Builder.followRedirects.

Specifies whether requests will automatically follow redirects issued by the server.

public HttpClient.Builder
localAddress(final InetAddress localAddr)

Overrides default java.net.http.HttpClient.Builder.localAddress.

Binds the socket to this local address when creating connections for sending requests.

public HttpClientBuilderImpl
priority(int priority)

Implements java.net.http.HttpClient.Builder.priority.

Sets the default priority for any HTTP/2 requests sent from this client.

public HttpClientBuilderImpl
public HttpClientBuilderImpl
sslContext(SSLContext sslContext)

Implements java.net.http.HttpClient.Builder.sslContext.

Sets an SSLContext.

public HttpClientBuilderImpl
sslParameters(SSLParameters sslParameters)

Implements java.net.http.HttpClient.Builder.sslParameters.

Sets an SSLParameters.

public HttpClientBuilderImpl
version(HttpClient.Version version)

Implements java.net.http.HttpClient.Builder.version.

Sets the default preferred HTTP protocol version for requests issued by this client.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authenticatorback to summary
pack-priv Authenticator authenticator
connectTimeoutback to summary
pack-priv Duration connectTimeout
cookieHandlerback to summary
pack-priv CookieHandler cookieHandler
executorback to summary
pack-priv Executor executor
followRedirectsback to summary
pack-priv HttpClient.Redirect followRedirects
localAddrback to summary
pack-priv InetAddress localAddr
priorityback to summary
pack-priv int priority
proxyback to summary
pack-priv ProxySelector proxy
sslContextback to summary
pack-priv SSLContext sslContext
sslParamsback to summary
pack-priv SSLParameters sslParams
versionback to summary
pack-priv HttpClient.Version version

Constructor Detail

HttpClientBuilderImplback to summary
public HttpClientBuilderImpl()

Method Detail

authenticatorback to summary
public HttpClientBuilderImpl authenticator(Authenticator a)

Implements java.net.http.HttpClient.Builder.authenticator.

Doc from java.net.http.HttpClient.Builder.authenticator.

Sets an authenticator to use for HTTP authentication.

Annotations
@Override
buildback to summary
public HttpClient build()

Implements java.net.http.HttpClient.Builder.build.

Doc from java.net.http.HttpClient.Builder.build.

Returns a new HttpClient built from the current state of this builder.

Annotations
@Override
connectTimeoutback to summary
public HttpClientBuilderImpl connectTimeout(Duration duration)

Implements java.net.http.HttpClient.Builder.connectTimeout.

Doc from java.net.http.HttpClient.Builder.connectTimeout.

Sets the connect timeout duration for this client.

In the case where a new connection needs to be established, if the connection cannot be established within the given duration, then HttpClient::send throws an HttpConnectTimeoutException, or HttpClient::sendAsync completes exceptionally with an HttpConnectTimeoutException. If a new connection does not need to be established, for example if a connection can be reused from a previous request, then this timeout duration has no effect.

Annotations
@Override
cookieHandlerback to summary
public HttpClientBuilderImpl cookieHandler(CookieHandler cookieHandler)

Implements java.net.http.HttpClient.Builder.cookieHandler.

Doc from java.net.http.HttpClient.Builder.cookieHandler.

Sets a cookie handler.

Annotations
@Override
executorback to summary
public HttpClientBuilderImpl executor(Executor s)

Implements java.net.http.HttpClient.Builder.executor.

Doc from java.net.http.HttpClient.Builder.executor.

Sets the executor to be used for asynchronous and dependent tasks.

If this method is not invoked prior to building, a default executor is created for each newly built HttpClient.

Annotations
@Override
followRedirectsback to summary
public HttpClientBuilderImpl followRedirects(HttpClient.Redirect policy)

Implements java.net.http.HttpClient.Builder.followRedirects.

Doc from java.net.http.HttpClient.Builder.followRedirects.

Specifies whether requests will automatically follow redirects issued by the server.

If this method is not invoked prior to building, then newly built clients will use a default redirection policy of NEVER.

Annotations
@Override
localAddressback to summary
public HttpClient.Builder localAddress(final InetAddress localAddr)

Overrides default java.net.http.HttpClient.Builder.localAddress.

Doc from java.net.http.HttpClient.Builder.localAddress.

Binds the socket to this local address when creating connections for sending requests.

If no local address is set or null is passed to this method then sockets created by the HTTP client will be bound to an automatically assigned socket address.

Common usages of the HttpClient do not require this method to be called. Setting a local address, through this method, is only for advanced usages where users of the HttpClient require specific control on which network interface gets used for the HTTP communication. Callers of this method are expected to be aware of the networking configurations of the system where the HttpClient will be used and care should be taken to ensure the correct localAddr is passed. Failure to do so can result in requests sent through the HttpClient to fail.

Annotations
@Override
priorityback to summary
public HttpClientBuilderImpl priority(int priority)

Implements java.net.http.HttpClient.Builder.priority.

Doc from java.net.http.HttpClient.Builder.priority.

Sets the default priority for any HTTP/2 requests sent from this client. The value provided must be between 1 and 256 (inclusive).

Annotations
@Override
proxyback to summary
public HttpClientBuilderImpl proxy(ProxySelector proxy)

Implements java.net.http.HttpClient.Builder.proxy.

Doc from java.net.http.HttpClient.Builder.proxy.

Sets a java.net.ProxySelector.

Annotations
@Override
sslContextback to summary
public HttpClientBuilderImpl sslContext(SSLContext sslContext)

Implements java.net.http.HttpClient.Builder.sslContext.

Doc from java.net.http.HttpClient.Builder.sslContext.

Sets an SSLContext.

If this method is not invoked prior to building, then newly built clients will use the default context, which is normally adequate for client applications that do not need to specify protocols, or require client authentication.

Annotations
@Override
sslParametersback to summary
public HttpClientBuilderImpl sslParameters(SSLParameters sslParameters)

Implements java.net.http.HttpClient.Builder.sslParameters.

Doc from java.net.http.HttpClient.Builder.sslParameters.

Sets an SSLParameters.

If this method is not invoked prior to building, then newly built clients will use a default, implementation specific, set of parameters.

Some parameters which are used internally by the HTTP Client implementation (such as the application protocol list) should not be set by callers, as they may be ignored. The contents of the given object are copied.

Annotations
@Override
versionback to summary
public HttpClientBuilderImpl version(HttpClient.Version version)

Implements java.net.http.HttpClient.Builder.version.

Doc from java.net.http.HttpClient.Builder.version.

Sets the default preferred HTTP protocol version for requests issued by this client.

If this method is not invoked prior to building, then newly built clients will prefer HTTP/2.

If a request doesn't have a preferred version, then the effective preferred version for the request is the client's preferred version.

Annotations
@Override