|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.cfa.vo.tapclient.util.HttpClient
public class HttpClient
A utility object which provides methods for RESTful interactions with a service.
Constructor Summary | |
---|---|
HttpClient()
|
Method Summary | |
---|---|
static java.lang.String |
asString(java.io.InputStream inputStream)
Concatenates the entire InputStream into a String. |
static java.io.InputStream |
delete(java.lang.String spec)
Sends an HTTP DELETE request to the fully specified url spec . |
static java.io.InputStream |
get(java.lang.String spec)
Sends an HTTP GET request to the fully specified url spec . |
static java.io.InputStream |
get(java.lang.String spec,
java.util.Map parameters)
Sends an HTTP GET request to the fully specified url spec . |
protected static java.io.InputStream |
handleResponse(org.apache.http.HttpResponse response)
|
static java.io.InputStream |
post(java.lang.String spec)
Sends an HTTP POST request to the fully specified url spec . |
static java.io.InputStream |
post(java.lang.String spec,
java.util.Map parameters)
Sends an HTTP POST request to the fully specified url spec . |
static java.io.InputStream |
post(java.lang.String spec,
java.util.Map<java.lang.String,java.lang.String> parameters,
java.util.Map<java.lang.String,java.net.URI> inlineContent)
Sends an HTTP POST request to the fully specified url spec . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HttpClient()
Method Detail |
---|
public static java.io.InputStream get(java.lang.String spec) throws HttpException, java.io.IOException
spec
.
spec
- the url.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.public static java.io.InputStream get(java.lang.String spec, java.util.Map parameters) throws HttpException, java.io.IOException
spec
.
spec
- the url.parameters
- the query parameters.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.
java.lang.NullPointerException
- if the url is null.public static java.io.InputStream post(java.lang.String spec) throws HttpException, java.io.IOException
spec
.
spec
- the url.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.public static java.io.InputStream post(java.lang.String spec, java.util.Map parameters) throws HttpException, java.io.IOException
spec
.
spec
- the url.parameters
- the query parameters.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.public static java.io.InputStream post(java.lang.String spec, java.util.Map<java.lang.String,java.lang.String> parameters, java.util.Map<java.lang.String,java.net.URI> inlineContent) throws HttpException, java.io.IOException
spec
.
spec
- the url.parameters
- the query parameters.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.public static java.io.InputStream delete(java.lang.String spec) throws HttpException, java.io.IOException
spec
.
spec
- the url.
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- in case of a problem or if the connection was aborted.protected static java.io.InputStream handleResponse(org.apache.http.HttpResponse response) throws HttpException, java.io.IOException
HttpException
- if the HTTP Status Code is not 200(OK).
java.io.IOException
- if the error occurs creating the InputStream.public static java.lang.String asString(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the InputStream to read into a String.
java.io.IOException
- if an error occurs handling the InputStream.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |