public interface HttpClientSpec
| Modifier and Type | Method and Description |
|---|---|
HttpClientSpec |
byteBufAllocator(io.netty.buffer.ByteBufAllocator byteBufAllocator)
The buffer allocator to use.
|
HttpClientSpec |
connectTimeout(java.time.Duration connectTimeout)
The connect timeout value for requests.
|
HttpClientSpec |
enableMetricsCollection(boolean enableMetricsCollection)
Enable metric collection on HTTP Client.
|
HttpClientSpec |
errorIntercept(Action<? super java.lang.Throwable> interceptor)
Add an interceptor for errors thrown by this client (eg.
|
HttpClientSpec |
idleTimeout(java.time.Duration idleTimeout)
The default amount of time to allow a connection to remain idle in the connection pool.
|
HttpClientSpec |
maxContentLength(int maxContentLength)
The maximum size to allow for responses.
|
HttpClientSpec |
poolQueueSize(int poolQueueSize)
The maximum number of requests that will be queued if connection pool was depleted.
|
HttpClientSpec |
poolSize(int poolSize)
The maximum number of connections to maintain to a given protocol/host/port.
|
HttpClientSpec |
readTimeout(java.time.Duration readTimeout)
The read timeout value for responses.
|
HttpClientSpec |
requestIntercept(Action<? super RequestSpec> interceptor)
Add an interceptor for all requests handled by this client.
|
HttpClientSpec |
responseIntercept(Action<? super HttpResponse> interceptor)
Add an interceptor for all responses returned by this client.
|
HttpClientSpec |
responseIntercept(Operation operation)
Execute the provide
Operation for all responses returned by this client. |
HttpClientSpec |
responseMaxChunkSize(int numBytes)
The max size of the chunks to emit when reading a response as a stream.
|
HttpClientSpec byteBufAllocator(io.netty.buffer.ByteBufAllocator byteBufAllocator)
Defaults to PooledByteBufAllocator.DEFAULT.
byteBufAllocator - the buffer allocatorthisHttpClientSpec poolSize(int poolSize)
Defaults to 0.
Setting this number to > 0 enables connection pooling (a.k.a. HTTP Keep Alive).
The given value dictates the number of connections to a given target, not the overall size.
Calling HttpClient.close() will close all current connections.
poolSize - the connection pool sizethisHttpClientSpec poolQueueSize(int poolQueueSize)
Defaults to Integer.MAX_VALUE.
Setting this option is recommended, because the http client queues requests when the pool is depleted. Once a connection is available, the request is processed and all resources released.
The option is not applied if pool size is not set.
poolQueueSize - the connection pool queue sizethisHttpClientSpec idleTimeout(java.time.Duration idleTimeout)
If the connection is idle for the timeout value, it will be closed.
A value of Duration.ZERO is interpreted as no timeout.
The value is never Duration.isNegative().
thisHttpClientSpec maxContentLength(int maxContentLength)
Defaults to ServerConfig.DEFAULT_MAX_CONTENT_LENGTH.
maxContentLength - the maximum response content lengththisHttpClientSpec readTimeout(java.time.Duration readTimeout)
Defaults to 30 seconds.
readTimeout - the read timeout value for responsesthisHttpClientSpec connectTimeout(java.time.Duration connectTimeout)
Defaults to 30 seconds.
connectTimeout - the connect timeout value for requeststhisHttpClientSpec responseMaxChunkSize(int numBytes)
Defaults to 8192.
Increasing this value can increase throughput at the expense of memory use.
numBytes - the max number of bytes to emitthisHttpClientSpec requestIntercept(Action<? super RequestSpec> interceptor)
This function is additive.
interceptor - the action to perform on the spec before transmitting.HttpClientSpec responseIntercept(Action<? super HttpResponse> interceptor)
This function is additive.
interceptor - the action to perform on the response before returning.thisHttpClientSpec responseIntercept(Operation operation)
Operation for all responses returned by this client.
This function will wrap the provided operation and subscribe to it.
This function is additive with responseIntercept(Action).
operation - the operation to subscribe to before return the response.thisHttpClientSpec errorIntercept(Action<? super java.lang.Throwable> interceptor)
This function is additive.
interceptor - the action to perform on the error before propagating.thisHttpClientSpec enableMetricsCollection(boolean enableMetricsCollection)
Defaults to false.
enableMetricsCollection - A boolean used to enable metric collection.this