@Deprecated public class OkHttpClientHttpRequestFactory extends java.lang.Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory, DisposableBean
ClientHttpRequestFactory
implementation that uses
OkHttp 2.x to create requests.OkHttp3ClientHttpRequestFactory
Modifier and Type | Field and Description |
---|---|
private OkHttpClient |
client
Deprecated.
|
private boolean |
defaultClient
Deprecated.
|
Constructor and Description |
---|
OkHttpClientHttpRequestFactory()
Deprecated.
Create a factory with a default
OkHttpClient instance. |
OkHttpClientHttpRequestFactory(OkHttpClient client)
Deprecated.
Create a factory with the given
OkHttpClient instance. |
Modifier and Type | Method and Description |
---|---|
(package private) static Request |
buildRequest(HttpHeaders headers,
byte[] content,
java.net.URI uri,
HttpMethod method)
Deprecated.
|
AsyncClientHttpRequest |
createAsyncRequest(java.net.URI uri,
HttpMethod httpMethod)
Deprecated.
Create a new asynchronous
AsyncClientHttpRequest for the specified URI
and HTTP method. |
ClientHttpRequest |
createRequest(java.net.URI uri,
HttpMethod httpMethod)
Deprecated.
Create a new
ClientHttpRequest for the specified URI and HTTP method. |
void |
destroy()
Deprecated.
Invoked by a BeanFactory on destruction of a singleton.
|
private static com.squareup.okhttp.MediaType |
getContentType(HttpHeaders headers)
Deprecated.
|
void |
setConnectTimeout(int connectTimeout)
Deprecated.
Sets the underlying connect timeout in milliseconds.
|
void |
setReadTimeout(int readTimeout)
Deprecated.
Sets the underlying read timeout in milliseconds.
|
void |
setWriteTimeout(int writeTimeout)
Deprecated.
Sets the underlying write timeout in milliseconds.
|
private final OkHttpClient client
private final boolean defaultClient
public OkHttpClientHttpRequestFactory()
OkHttpClient
instance.public OkHttpClientHttpRequestFactory(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(java.net.URI uri, HttpMethod httpMethod)
ClientHttpRequestFactory
ClientHttpRequest
for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.
createRequest
in interface ClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executepublic AsyncClientHttpRequest createAsyncRequest(java.net.URI uri, HttpMethod httpMethod)
AsyncClientHttpRequestFactory
AsyncClientHttpRequest
for the specified URI
and HTTP method.
The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync()
.
createAsyncRequest
in interface AsyncClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executepublic void destroy() throws java.io.IOException
DisposableBean
destroy
in interface DisposableBean
java.io.IOException
static Request buildRequest(HttpHeaders headers, byte[] content, java.net.URI uri, HttpMethod method) throws java.net.MalformedURLException
java.net.MalformedURLException
private static com.squareup.okhttp.MediaType getContentType(HttpHeaders headers)