Package org.springframework.http.client
Class JdkClientHttpRequestFactory
java.lang.Object
org.springframework.http.client.JdkClientHttpRequestFactory
- All Implemented Interfaces:
- ClientHttpRequestFactory
ClientHttpRequestFactory implementation based on the Java HttpClient.- Since:
- 6.1
- Author:
- Marten Deinum, Arjen Poutsma
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new instance of theJdkClientHttpRequestFactorywith a defaultHttpClient.JdkClientHttpRequestFactory(HttpClient httpClient) Create a new instance of theJdkClientHttpRequestFactorybased on the givenHttpClient.JdkClientHttpRequestFactory(HttpClient httpClient, Executor executor) Create a new instance of theJdkClientHttpRequestFactorybased on the givenHttpClientandExecutor.
- 
Method SummaryModifier and TypeMethodDescriptioncreateRequest(URI uri, HttpMethod httpMethod) Create a newClientHttpRequestfor the specified URI and HTTP method.voidsetReadTimeout(int readTimeout) Set the underlyingHttpClient's read timeout (in milliseconds).voidsetReadTimeout(Duration readTimeout) Set the underlyingHttpClient's read timeout as aDuration.
- 
Constructor Details- 
JdkClientHttpRequestFactorypublic JdkClientHttpRequestFactory()Create a new instance of theJdkClientHttpRequestFactorywith a defaultHttpClient.
- 
JdkClientHttpRequestFactoryCreate a new instance of theJdkClientHttpRequestFactorybased on the givenHttpClient.- Parameters:
- httpClient- the client to base on
 
- 
JdkClientHttpRequestFactoryCreate a new instance of theJdkClientHttpRequestFactorybased on the givenHttpClientandExecutor.- Parameters:
- httpClient- the client to base on
- executor- the executor to use for blocking write operations
 
 
- 
- 
Method Details- 
setReadTimeoutpublic void setReadTimeout(int readTimeout) Set the underlyingHttpClient's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.Default is the system's default timeout. 
- 
setReadTimeoutSet the underlyingHttpClient's read timeout as aDuration.Default is the system's default timeout. 
- 
createRequestDescription copied from interface:ClientHttpRequestFactoryCreate a newClientHttpRequestfor the specified URI and HTTP method.The returned request can be written to, and then executed by calling ClientHttpRequest.execute().- Specified by:
- createRequestin interface- ClientHttpRequestFactory
- Parameters:
- uri- the URI to create a request for
- httpMethod- the HTTP method to execute
- Returns:
- the created request
- Throws:
- IOException- in case of I/O errors
 
 
-