|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.go.trove.net.HttpClient
| Inner Class Summary | |
static interface |
HttpClient.PostData
A factory for supplying data to be written to server in a POST request. |
class |
HttpClient.Response
|
| Constructor Summary | |
HttpClient(SocketFactory factory)
Constructs a HttpClient with a read timeout that matches the given factory's connect timeout. |
|
HttpClient(SocketFactory factory,
long readTimeout)
|
|
| Method Summary | |
HttpClient |
addHeader(java.lang.String name,
java.lang.Object value)
Add a header name-value pair to the request in order for multiple values to be specified. |
HttpClient.Response |
getResponse()
Opens a connection, passes on the current request settings, and returns the server's response. |
HttpClient.Response |
getResponse(HttpClient.PostData postData)
Opens a connection, passes on the current request settings, and returns the server's response. |
HttpClient |
preparePost(int contentLength)
Convenience method for preparing a post to the server. |
HttpClient |
setHeader(java.lang.String name,
java.lang.Object value)
Set a header name-value pair to the request. |
HttpClient |
setHeaders(HttpHeaderMap headers)
Set all the headers for this request, replacing any existing headers. |
HttpClient |
setMethod(java.lang.String method)
Set the HTTP request method, which defaults to "GET". |
HttpClient |
setPersistent(boolean b)
Convenience method for setting the "Connection" header to "Keep-Alive" or "Close". |
HttpClient |
setProtocol(java.lang.String protocol)
Set the HTTP protocol string, which defaults to "HTTP/1.0". |
HttpClient |
setSession(java.lang.Object session)
Optionally specify a session for getting connections. |
HttpClient |
setURI(java.lang.String uri)
Set the URI to request, which can include a query string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public HttpClient(SocketFactory factory)
factory - source of socket connections
public HttpClient(SocketFactory factory,
long readTimeout)
factory - source of socket connectionsreadTimeout - timeout on socket read operations before throwing a
InterruptedIOException| Method Detail |
public HttpClient setMethod(java.lang.String method)
public HttpClient setURI(java.lang.String uri)
public HttpClient setProtocol(java.lang.String protocol)
public HttpClient setHeader(java.lang.String name,
java.lang.Object value)
public HttpClient addHeader(java.lang.String name,
java.lang.Object value)
public HttpClient setHeaders(HttpHeaderMap headers)
public HttpClient setPersistent(boolean b)
b - true for persistent connectionpublic HttpClient preparePost(int contentLength)
contentLength - number of bytes to be postedpublic HttpClient setSession(java.lang.Object session)
session - Object whose hashcode might be used to select a specific
connection if factory is distributed. If null, then no session is used.
public HttpClient.Response getResponse()
throws java.net.ConnectException,
java.net.SocketException
public HttpClient.Response getResponse(HttpClient.PostData postData)
throws java.net.ConnectException,
java.net.SocketException
postData - additional data to supply to the server, if request
method is POST
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||