Class OkHttp3ClientHttpRequestFactory

java.lang.Object
org.springframework.http.client.OkHttp3ClientHttpRequestFactory
All Implemented Interfaces:
DisposableBean, ClientHttpRequestFactory

@Deprecated(since="6.1", forRemoval=true) public class OkHttp3ClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, DisposableBean
Deprecated, for removal: This API element is subject to removal in a future version.
since 6.1, in favor of other ClientHttpRequestFactory implementations; scheduled for removal in 7.0
ClientHttpRequestFactory implementation that uses OkHttp 3.x to create requests.
Since:
4.3
Author:
Luciano Leggieri, Arjen Poutsma, Roy Clarkson
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a factory with a default OkHttpClient instance.
    OkHttp3ClientHttpRequestFactory(okhttp3.OkHttpClient client)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a factory with the given OkHttpClient instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    createRequest(URI uri, HttpMethod httpMethod)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a new ClientHttpRequest for the specified URI and HTTP method.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Invoked by the containing BeanFactory on destruction of a bean.
    void
    setConnectTimeout(int connectTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying connect timeout in milliseconds.
    void
    setConnectTimeout(Duration connectTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying connect timeout in milliseconds.
    void
    setReadTimeout(int readTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying read timeout in milliseconds.
    void
    setReadTimeout(Duration readTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying read timeout in milliseconds.
    void
    setWriteTimeout(int writeTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying write timeout in milliseconds.
    void
    setWriteTimeout(Duration writeTimeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the underlying write timeout in milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OkHttp3ClientHttpRequestFactory

      public OkHttp3ClientHttpRequestFactory()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a factory with a default OkHttpClient instance.
    • OkHttp3ClientHttpRequestFactory

      public OkHttp3ClientHttpRequestFactory(okhttp3.OkHttpClient client)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a factory with the given OkHttpClient instance.
      Parameters:
      client - the client to use
  • Method Details

    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying read timeout in milliseconds. A value of 0 specifies an infinite timeout.
    • setReadTimeout

      public void setReadTimeout(Duration readTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying read timeout in milliseconds. A value of 0 specifies an infinite timeout.
      Since:
      6.1
    • setWriteTimeout

      public void setWriteTimeout(int writeTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying write timeout in milliseconds. A value of 0 specifies an infinite timeout.
    • setWriteTimeout

      public void setWriteTimeout(Duration writeTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying write timeout in milliseconds. A value of 0 specifies an infinite timeout.
      Since:
      6.1
    • setConnectTimeout

      public void setConnectTimeout(int connectTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.
    • setConnectTimeout

      public void setConnectTimeout(Duration connectTimeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Set the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.
      Since:
      6.1
    • createRequest

      public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: ClientHttpRequestFactory
      Create a new ClientHttpRequest for the specified URI and HTTP method.

      The returned request can be written to, and then executed by calling ClientHttpRequest.execute().

      Specified by:
      createRequest in interface ClientHttpRequestFactory
      Parameters:
      uri - the URI to create a request for
      httpMethod - the HTTP method to execute
      Returns:
      the created request
    • destroy

      public void destroy() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: DisposableBean
      Invoked by the containing BeanFactory on destruction of a bean.
      Specified by:
      destroy in interface DisposableBean
      Throws:
      IOException