|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.http.client.SimpleClientHttpRequestFactory
public class SimpleClientHttpRequestFactory
ClientHttpRequestFactory
implementation that uses standard J2SE facilities.
HttpURLConnection
,
CommonsClientHttpRequestFactory
Field Summary | |
---|---|
private int |
connectTimeout
|
private java.net.Proxy |
proxy
|
private int |
readTimeout
|
Constructor Summary | |
---|---|
SimpleClientHttpRequestFactory()
|
Method Summary | |
---|---|
ClientHttpRequest |
createRequest(java.net.URI uri,
HttpMethod httpMethod)
Create a new ClientHttpRequest for the specified URI and HTTP method. |
protected java.net.HttpURLConnection |
openConnection(java.net.URL url,
java.net.Proxy proxy)
Opens and returns a connection to the given URL. |
protected void |
prepareConnection(java.net.HttpURLConnection connection,
java.lang.String httpMethod)
Template method for preparing the given HttpURLConnection . |
void |
setConnectTimeout(int connectTimeout)
Set the underlying URLConnection's connect timeout (in milliseconds). |
void |
setProxy(java.net.Proxy proxy)
Set the Proxy to use for this request factory. |
void |
setReadTimeout(int readTimeout)
Set the underlying URLConnection's read timeout (in milliseconds). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.net.Proxy proxy
private int connectTimeout
private int readTimeout
Constructor Detail |
---|
public SimpleClientHttpRequestFactory()
Method Detail |
---|
public void setProxy(java.net.Proxy proxy)
Proxy
to use for this request factory.
public void setConnectTimeout(int connectTimeout)
Default is the system's default timeout.
URLConnection.setConnectTimeout(int)
public void setReadTimeout(int readTimeout)
Default is the system's default timeout.
URLConnection.setReadTimeout(int)
public ClientHttpRequest createRequest(java.net.URI uri, HttpMethod httpMethod) throws java.io.IOException
ClientHttpRequestFactory
ClientHttpRequest
for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.
createRequest
in interface ClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to execute
java.io.IOException
- in case of I/O errorsprotected java.net.HttpURLConnection openConnection(java.net.URL url, java.net.Proxy proxy) throws java.io.IOException
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 be null
java.io.IOException
- in case of I/O errorsprotected void prepareConnection(java.net.HttpURLConnection connection, java.lang.String httpMethod) throws java.io.IOException
HttpURLConnection
.
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.)
java.io.IOException
- in case of I/O errors
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |