public class OkHttpAsyncHttpClientBuilder extends Object
HttpClient backed by OkHttp.| Constructor and Description |
|---|
OkHttpAsyncHttpClientBuilder()
Creates OkHttpAsyncHttpClientBuilder.
|
OkHttpAsyncHttpClientBuilder(okhttp3.OkHttpClient okHttpClient)
Creates OkHttpAsyncHttpClientBuilder from the builder of an existing OkHttpClient.
|
| Modifier and Type | Method and Description |
|---|---|
OkHttpAsyncHttpClientBuilder |
addNetworkInterceptor(okhttp3.Interceptor networkInterceptor)
Add a network layer interceptor to Http request pipeline.
|
HttpClient |
build()
Creates a new OkHttp-backed
HttpClient instance on every call, using the
configuration set in the builder at the time of the build method call. |
OkHttpAsyncHttpClientBuilder |
configuration(Configuration configuration)
Sets the configuration store that is used during construction of the HTTP client.
|
OkHttpAsyncHttpClientBuilder |
connectionPool(okhttp3.ConnectionPool connectionPool)
Sets the Http connection pool.
|
OkHttpAsyncHttpClientBuilder |
connectionTimeout(Duration connectionTimeout)
Sets the connection timeout.
|
OkHttpAsyncHttpClientBuilder |
dispatcher(okhttp3.Dispatcher dispatcher)
Sets the dispatcher that also composes the thread pool for executing HTTP requests.
|
OkHttpAsyncHttpClientBuilder |
networkInterceptors(List<okhttp3.Interceptor> networkInterceptors)
Add network layer interceptors to Http request pipeline.
|
OkHttpAsyncHttpClientBuilder |
proxy(ProxyOptions proxyOptions)
Sets the proxy.
|
OkHttpAsyncHttpClientBuilder |
readTimeout(Duration readTimeout)
Sets the read timeout.
|
OkHttpAsyncHttpClientBuilder |
writeTimeout(Duration writeTimeout)
Sets the write timeout.
|
public OkHttpAsyncHttpClientBuilder()
public OkHttpAsyncHttpClientBuilder(okhttp3.OkHttpClient okHttpClient)
okHttpClient - the httpclientpublic OkHttpAsyncHttpClientBuilder addNetworkInterceptor(okhttp3.Interceptor networkInterceptor)
networkInterceptor - the interceptor to addpublic OkHttpAsyncHttpClientBuilder networkInterceptors(List<okhttp3.Interceptor> networkInterceptors)
This replaces all previously-set interceptors.
networkInterceptors - The interceptors to add.public OkHttpAsyncHttpClientBuilder readTimeout(Duration readTimeout)
If readTimeout is null a default timeout of 60 seconds will be used. If the timeout is less than
or equal to zero then no timeout will be used. Otherwise, the maximum of one millisecond and the passed timeout
will be used.
readTimeout - The read timeout.public OkHttpAsyncHttpClientBuilder writeTimeout(Duration writeTimeout)
If writeTimeout is null a default timeout of 60 seconds will be used. If the timeout is less than
or equal to zero then no timeout will be used. Otherwise, the maximum of one millisecond and the passed timeout
will be used.
writeTimeout - The write timeout.public OkHttpAsyncHttpClientBuilder connectionTimeout(Duration connectionTimeout)
If connectionTimeout is null or less than or equal to zero a default timeout of 10 seconds will
be used. Otherwise, the maximum of one millisecond and the passed timeout will be used.
connectionTimeout - The connection timeout.public OkHttpAsyncHttpClientBuilder connectionPool(okhttp3.ConnectionPool connectionPool)
connectionPool - The OkHttp connection pool to use.public OkHttpAsyncHttpClientBuilder dispatcher(okhttp3.Dispatcher dispatcher)
dispatcher - The dispatcher to use.public OkHttpAsyncHttpClientBuilder proxy(ProxyOptions proxyOptions)
proxyOptions - The proxy configuration to use.public OkHttpAsyncHttpClientBuilder configuration(Configuration configuration)
The default configuration store is a clone of the global
configuration store, use Configuration.NONE to bypass using configuration settings during construction.
configuration - The configuration store.public HttpClient build()
HttpClient instance on every call, using the
configuration set in the builder at the time of the build method call.HttpClient instance.Copyright © 2021 Microsoft Corporation. All rights reserved.