Package org.springframework.http.client
Class SimpleClientHttpRequestFactory
java.lang.Object
org.springframework.http.client.SimpleClientHttpRequestFactory
- All Implemented Interfaces:
- ClientHttpRequestFactory
ClientHttpRequestFactory implementation that uses standard JDK facilities.- Since:
- 3.0
- Author:
- Arjen Poutsma, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateRequest(URI uri, HttpMethod httpMethod) Create a newClientHttpRequestfor the specified URI and HTTP method.protected HttpURLConnectionopenConnection(URL url, @Nullable Proxy proxy) Opens and returns a connection to the given URL.protected voidprepareConnection(HttpURLConnection connection, String 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).
- 
Constructor Details- 
SimpleClientHttpRequestFactorypublic SimpleClientHttpRequestFactory()
 
- 
- 
Method Details- 
setProxySet theProxyto use for this request factory.
- 
setChunkSizepublic void setChunkSize(int chunkSize) Set the number of bytes to write in each chunk when not buffering request bodies locally.
- 
setConnectTimeoutpublic 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. - See Also:
 
- 
setConnectTimeoutSet the underlying URLConnection's connect timeout asDuration. A timeout value of 0 specifies an infinite timeout.Default is the system's default timeout. - Since:
- 6.1
- See Also:
 
- 
setReadTimeoutpublic 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. - See Also:
 
- 
setReadTimeoutSet the underlying URLConnection's read timeout (in milliseconds). A timeout value of 0 specifies an infinite timeout.Default is the system's default timeout. - Since:
- 6.1
- See Also:
 
- 
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
 
- 
openConnectionOpens and returns a connection to the given URL.The default implementation uses the given proxy - if any - to open a connection. - Parameters:
- url- the URL to open a connection to
- proxy- the proxy to use, may be- null
- Returns:
- the opened connection
- Throws:
- IOException- in case of I/O errors
 
- 
prepareConnectionprotected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException Template method for preparing the givenHttpURLConnection.The default implementation prepares the connection for input and output, and sets the HTTP method. - Parameters:
- connection- the connection to prepare
- httpMethod- the HTTP request method (- GET,- POST, etc.)
- Throws:
- IOException- in case of I/O errors
 
 
-