public static class HttpClientConfiguration.Builder extends Object
HttpClientConfiguration
s. At the very least, a name must be provided.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
HttpClientConfiguration |
build() |
HttpClientConfiguration.Builder |
setClientSocketProperties(TcpClientSocketProperties clientSocketProperties)
Optionally defines TCP specific properties like the socket connection timeout, for example, via a
TcpClientSocketProperties . |
HttpClientConfiguration.Builder |
setConnectionIdleTimeout(int connectionIdleTimeout)
Defines the number of milliseconds that a connection can remain idle before being closed.
|
HttpClientConfiguration.Builder |
setMaxConnections(int maxConnections)
Defines the maximum number of outbound connections that will be kept open at the same time.
|
HttpClientConfiguration.Builder |
setName(String name)
Defines the name of the
HttpClient . |
HttpClientConfiguration.Builder |
setProxyConfig(ProxyConfig proxyConfig)
Required when connecting through a proxy, this defines the relevant data to do so using a
ProxyConfig . |
HttpClientConfiguration.Builder |
setResponseBufferSize(int responseBufferSize)
Defines the size of the buffer in bytes used to store the HTTP response, the default value is 10KB.
|
HttpClientConfiguration.Builder |
setStreaming(boolean streaming)
Defines whether the HTTP response should be streamed, meaning processing will continue as soon as all headers are parsed and
the body populated as it arrives.
|
HttpClientConfiguration.Builder |
setTlsContextFactory(TlsContextFactory tlsContextFactory)
Required exclusively for HTTPS, this defines through a
TlsContextFactory all the TLS related data to establish
such connections. |
HttpClientConfiguration.Builder |
setUsePersistentConnections(boolean usePersistentConnections)
Defines if connections should be kept after a request is completed or closed.
|
public HttpClientConfiguration.Builder setTlsContextFactory(TlsContextFactory tlsContextFactory)
TlsContextFactory
all the TLS related data to establish
such connections. Set to null
by default.tlsContextFactory
- a TlsContextFactory
with the required data.public HttpClientConfiguration.Builder setProxyConfig(ProxyConfig proxyConfig)
ProxyConfig
. Set to
null
by default.proxyConfig
- a ProxyConfig
specifying the proxy datapublic HttpClientConfiguration.Builder setClientSocketProperties(TcpClientSocketProperties clientSocketProperties)
TcpClientSocketProperties
. Set to null
by default, transport default values will be used in that case.clientSocketProperties
- a TcpClientSocketProperties
specifying each propertypublic HttpClientConfiguration.Builder setMaxConnections(int maxConnections)
maxConnections
- number of connections to allowpublic HttpClientConfiguration.Builder setUsePersistentConnections(boolean usePersistentConnections)
true
.usePersistentConnections
- boolean
specifying the decisionpublic HttpClientConfiguration.Builder setConnectionIdleTimeout(int connectionIdleTimeout)
connectionIdleTimeout
- timeout value (in milliseconds)public HttpClientConfiguration.Builder setStreaming(boolean streaming)
false
.
When streaming is enabled, because of the internal buffer used to hold the arriving body chunks, the response MUST be
eventually read or the worker threads handling the chunks will block waiting to allocate them. Likewise, read/write speed
differences could cause issues. Buffer size can be customized for these reasons. Additionally, to avoid deadlocks, a hand
off to another thread MUST be performed before consuming the response.streaming
- whether or not to enable streamingpublic HttpClientConfiguration.Builder setResponseBufferSize(int responseBufferSize)
responseBufferSize
- buffer size (in bytes)public HttpClientConfiguration.Builder setName(String name)
HttpClient
. Must be specified.name
- a String
representing the prefixpublic HttpClientConfiguration build()
HttpClientConfiguration
as specified.Copyright © 2018. All rights reserved.