类 SimpleClientHttpRequestFactory
java.lang.Object
cn.taketoday.http.client.SimpleClientHttpRequestFactory
- 所有已实现的接口:
ClientHttpRequestFactory
ClientHttpRequestFactory implementation that uses standard JDK facilities.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Juergen Hoeller, Harry Yang
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明createRequest(URI uri, HttpMethod httpMethod) Create a newClientHttpRequestfor the specified URI and HTTP method.protected HttpURLConnectionopenConnection(URL url, Proxy proxy) Opens and returns a connection to the given URL.protected voidprepareConnection(HttpURLConnection connection, HttpMethod httpMethod) Template method for preparing the givenHttpURLConnection.voidsetChunkSize(int chunkSize) Set the number of bytes to write in each chunk when not buffering request bodies locally.voidsetConnectTimeout(int connectTimeout) Set the underlying URLConnection's connect timeout (in milliseconds).voidsetConnectTimeout(Duration connectTimeout) Set the underlying URLConnection's connect timeout asDuration.voidSet theProxyto use for this request factory.voidsetReadTimeout(int readTimeout) Set the underlying URLConnection's read timeout (in milliseconds).voidsetReadTimeout(Duration readTimeout) Set the underlying URLConnection's read timeout (in milliseconds).
-
字段详细资料
-
DEFAULT_CHUNK_SIZE
private static final int DEFAULT_CHUNK_SIZE- 另请参阅:
-
proxy
-
chunkSize
private int chunkSize -
connectTimeout
private int connectTimeout -
readTimeout
private int readTimeout
-
-
构造器详细资料
-
SimpleClientHttpRequestFactory
public SimpleClientHttpRequestFactory()
-
-
方法详细资料
-
setProxy
Set theProxyto 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 theContent-Lengthis 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
Set the underlying URLConnection's connect timeout asDuration. 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
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
从接口复制的说明:ClientHttpRequestFactoryCreate a newClientHttpRequestfor 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 forhttpMethod- the HTTP method to execute- 返回:
- the created request
- 抛出:
IOException- in case of I/O errors
-
openConnection
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 toproxy- the proxy to use, may benull- 返回:
- 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 givenHttpURLConnection.The default implementation prepares the connection for input and output, and sets the HTTP method.
- 参数:
connection- the connection to preparehttpMethod- the HTTP request method (GET,POST, etc.)- 抛出:
IOException- in case of I/O errors
-