类 SimpleClientHttpRequestFactory

java.lang.Object
cn.taketoday.http.client.SimpleClientHttpRequestFactory
所有已实现的接口:
ClientHttpRequestFactory
直接已知子类:
ClientHttpRequestFactories.Simple.SimpleClientHttpsRequestFactory

public class SimpleClientHttpRequestFactory extends Object implements ClientHttpRequestFactory
ClientHttpRequestFactory implementation that uses standard JDK facilities.
从以下版本开始:
4.0
作者:
Arjen Poutsma, Juergen Hoeller, Harry Yang
另请参阅:
  • 字段详细资料

    • DEFAULT_CHUNK_SIZE

      private static final int DEFAULT_CHUNK_SIZE
      另请参阅:
    • proxy

      @Nullable private Proxy proxy
    • chunkSize

      private int chunkSize
    • connectTimeout

      private int connectTimeout
    • readTimeout

      private int readTimeout
  • 构造器详细资料

    • SimpleClientHttpRequestFactory

      public SimpleClientHttpRequestFactory()
  • 方法详细资料

    • setProxy

      public void setProxy(Proxy proxy)
      Set the Proxy to use for this request factory.
    • setChunkSize

      public void setChunkSize(int chunkSize)
      Set the number of bytes to write in each chunk when not buffering request bodies locally.

      Note that this parameter is only used when bufferRequestBody is false, and the Content-Length is not known in advance.

    • setConnectTimeout

      public void setConnectTimeout(int connectTimeout)
      Set the underlying URLConnection's connect timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.

      Default is the system's default timeout.

      另请参阅:
    • setConnectTimeout

      public void setConnectTimeout(Duration connectTimeout)
      Set the underlying URLConnection's connect timeout as Duration. A timeout value of 0 specifies an infinite timeout.

      Default is the system's default timeout.

      另请参阅:
    • setReadTimeout

      public void setReadTimeout(int readTimeout)
      Set the underlying URLConnection's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.

      Default is the system's default timeout.

      另请参阅:
    • setReadTimeout

      public void setReadTimeout(Duration readTimeout)
      Set the underlying URLConnection's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.

      Default is the system's default timeout.

      另请参阅:
    • createRequest

      public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException
      从接口复制的说明: 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().

      指定者:
      createRequest 在接口中 ClientHttpRequestFactory
      参数:
      uri - the URI to create a request for
      httpMethod - the HTTP method to execute
      返回:
      the created request
      抛出:
      IOException - in case of I/O errors
    • openConnection

      protected HttpURLConnection openConnection(URL url, @Nullable Proxy proxy) throws IOException
      Opens and returns a connection to the given URL.

      The default implementation uses the given proxy - if any - to open a connection.

      参数:
      url - the URL to open a connection to
      proxy - the proxy to use, may be null
      返回:
      the opened connection
      抛出:
      IOException - in case of I/O errors
    • prepareConnection

      protected void prepareConnection(HttpURLConnection connection, HttpMethod httpMethod) throws IOException
      Template method for preparing the given HttpURLConnection.

      The default implementation prepares the connection for input and output, and sets the HTTP method.

      参数:
      connection - the connection to prepare
      httpMethod - the HTTP request method (GET, POST, etc.)
      抛出:
      IOException - in case of I/O errors