public class OkHttpClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory, DisposableBean
ClientHttpRequestFactory implementation that uses
 OkHttp to create requests.| Constructor and Description | 
|---|
| OkHttpClientHttpRequestFactory()Create a factory with a default  OkHttpClientinstance. | 
| OkHttpClientHttpRequestFactory(com.squareup.okhttp.OkHttpClient client)Create a factory with the given  OkHttpClientinstance. | 
| Modifier and Type | Method and Description | 
|---|---|
| AsyncClientHttpRequest | createAsyncRequest(URI uri,
                  HttpMethod httpMethod)Create a new asynchronous  AsyncClientHttpRequestfor the specified URI
 and HTTP method. | 
| ClientHttpRequest | createRequest(URI uri,
             HttpMethod httpMethod)Create a new  ClientHttpRequestfor the specified URI and HTTP method. | 
| void | destroy()Invoked by a BeanFactory on destruction of a singleton. | 
| void | setConnectTimeout(int connectTimeout)Sets the underlying connect timeout in milliseconds. | 
| void | setReadTimeout(int readTimeout)Sets the underlying read timeout in milliseconds. | 
| void | setWriteTimeout(int writeTimeout)Sets the underlying write timeout in milliseconds. | 
public OkHttpClientHttpRequestFactory()
OkHttpClient instance.public OkHttpClientHttpRequestFactory(com.squareup.okhttp.OkHttpClient client)
OkHttpClient instance.client - the client to usepublic void setReadTimeout(int readTimeout)
OkHttpClient.setReadTimeout(long, TimeUnit)public void setWriteTimeout(int writeTimeout)
OkHttpClient.setWriteTimeout(long, TimeUnit)public void setConnectTimeout(int connectTimeout)
OkHttpClient.setConnectTimeout(long, TimeUnit)public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
ClientHttpRequestFactoryClientHttpRequest for the specified URI and HTTP method.
 The returned request can be written to, and then executed by calling
 ClientHttpRequest.execute().
createRequest in interface ClientHttpRequestFactoryuri - the URI to create a request forhttpMethod - the HTTP method to executepublic AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod httpMethod)
AsyncClientHttpRequestFactoryAsyncClientHttpRequest for the specified URI
 and HTTP method.
 The returned request can be written to, and then executed by calling
 AsyncClientHttpRequest.executeAsync().
createAsyncRequest in interface AsyncClientHttpRequestFactoryuri - the URI to create a request forhttpMethod - the HTTP method to executepublic void destroy()
             throws Exception
DisposableBeandestroy in interface DisposableBeanException - in case of shutdown errors.
 Exceptions will get logged but not rethrown to allow
 other beans to release their resources too.