|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectSimpleHttpClient
public class SimpleHttpClient
A simple HTTPClient that creates a new HTTP connection for each
request.
| Nested Class Summary | |
|---|---|
static class |
SimpleHttpClient.SimpleHTTPResponse
|
| Constructor Summary | |
|---|---|
SimpleHttpClient()
|
|
| Method Summary | |
|---|---|
HTTPResponse |
get(URL url)
Executes an HTTP GET request against the provided URL and returns the server response. |
int |
getConnectTimeout()
|
String |
getPassword()
|
int |
getReadTimeout()
|
String |
getUser()
|
boolean |
isTryGzip()
|
HTTPResponse |
post(URL url,
InputStream postContent,
String postContentType)
Executes an HTTP POST request against the provided URL, sending the contents of postContent as the POST method body and setting the Content-Type request header to
postContentType if given, and returns the server response. |
void |
setConnectTimeout(int connectTimeout)
|
void |
setPassword(String password)
|
void |
setReadTimeout(int readTimeout)
|
void |
setTryGzip(boolean tryGZIP)
|
void |
setUser(String user)
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleHttpClient()
| Method Detail |
|---|
public String getUser()
getUser in interface HTTPClientnull if not setpublic void setUser(String user)
setUser in interface HTTPClientuser - the HTTP BASIC Authentication user namepublic String getPassword()
getPassword in interface HTTPClientnull if not setpublic void setPassword(String password)
setPassword in interface HTTPClientpassword - the HTTP BASIC Authentication passwordpublic int getConnectTimeout()
getConnectTimeout in interface HTTPClientpublic void setConnectTimeout(int connectTimeout)
setConnectTimeout in interface HTTPClientconnectTimeout - tcp/ip connect timeout in secondspublic int getReadTimeout()
getReadTimeout in interface HTTPClientpublic void setReadTimeout(int readTimeout)
setReadTimeout in interface HTTPClientreadTimeout - socket read timeout in seconds
public HTTPResponse get(URL url)
throws IOException
HTTPClient
If an HTTP authentication user and password is set,
the appropriate authentication HTTP header will be sent with the request.
If a connection timeout is set, the http connection will be set
to respect that timeout.
If a read timeout is set, the http connection will be set to
respect it.
get in interface HTTPClienturl - the URL to retrieve
HTTPResponse encapsulating the response to the HTTP GET request
IOExceptionHTTPClient.get(java.net.URL)
public HTTPResponse post(URL url,
InputStream postContent,
String postContentType)
throws IOException
HTTPClientpostContent as the POST method body and setting the Content-Type request header to
postContentType if given, and returns the server response.
If an HTTP authentication user and password is set,
the appropriate authentication HTTP header will be sent with the request.
If a connection timeout is set, the http connection will be set
to respect that timeout.
If a read timeout is set, the http connection will be set to
respect it.
post in interface HTTPClienturl - the URL against which to execute the POST requestpostContent - an input stream with the contents of the POST bodypostContentType - the MIME type of the contents sent as the request POST body, can be null
HTTPResponse encapsulating the response to the HTTP POST request
IOExceptionHTTPClient.post(java.net.URL, java.io.InputStream,
java.lang.String)public void setTryGzip(boolean tryGZIP)
setTryGzip in interface HTTPClienttryGZIP - HTTPClient.setTryGzip(boolean)public boolean isTryGzip()
isTryGzip in interface HTTPClientHTTPClient.isTryGzip()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||