|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<String,Object>
com.google.api.client.util.GenericData
com.google.api.client.http.json.JsonHttpRequest
public class JsonHttpRequest
JSON HTTP request to JsonHttpClient
.
Implementation is not thread-safe.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
JsonHttpRequest(JsonHttpClient client,
HttpMethod method,
String uriTemplate,
Object content)
Builds an instance of JsonHttpRequest . |
Method Summary | |
---|---|
HttpRequest |
buildHttpRequest()
Create an HttpRequest suitable for use against this service. |
GenericUrl |
buildHttpRequestUrl()
Creates a new instance of GenericUrl suitable for use against this service. |
void |
download(OutputStream outputStream)
Sends the request to the server and writes the content input stream of HttpResponse
into the given destination output stream. |
InputStream |
executeAsInputStream()
Sends the request to the server and returns the content input stream of HttpResponse . |
HttpResponse |
executeUnparsed()
Sends the request to the server and returns the raw HttpResponse . |
JsonHttpClient |
getClient()
Returns the JSON HTTP client which handles this request. |
Object |
getJsonContent()
Returns a POJO that can be serialized into JSON or null for none. |
HttpHeaders |
getLastResponseHeaders()
Gets the HTTP headers of the last response or null for none. |
HttpMethod |
getMethod()
Returns the HTTP Method type. |
HttpHeaders |
getRequestHeaders()
Gets the HTTP headers used for the JSON HTTP request. |
String |
getUriTemplate()
Returns the URI template. |
JsonHttpRequest |
setRequestHeaders(HttpHeaders headers)
Sets the HTTP headers used for the JSON HTTP request. |
Methods inherited from class com.google.api.client.util.GenericData |
---|
clone, entrySet, get, getUnknownKeys, put, putAll, remove, set, setUnknownKeys |
Methods inherited from class java.util.AbstractMap |
---|
clear, containsKey, containsValue, equals, hashCode, isEmpty, keySet, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JsonHttpRequest(JsonHttpClient client, HttpMethod method, String uriTemplate, Object content)
JsonHttpRequest
.
client
- The JSON HTTP client which handles this requestmethod
- HTTP Method typeuriTemplate
- URI template for the path relative to the base URL specified in JSON HTTP
client. If it starts with a "/" the base path from the base URL will be stripped out.
The URI template can also be a full URL. URI template expansion is done using UriTemplate.expand(String, String, Object, boolean)
content
- A POJO that can be serialized into JSON or null
for noneMethod Detail |
---|
public final HttpMethod getMethod()
public final String getUriTemplate()
public final Object getJsonContent()
null
for none.
public final JsonHttpClient getClient()
public JsonHttpRequest setRequestHeaders(HttpHeaders headers)
These headers are set on the request after buildHttpRequest()
is called, this means that
HttpRequestInitializer.initialize(com.google.api.client.http.HttpRequest)
is called first.
public final HttpHeaders getRequestHeaders()
public final HttpHeaders getLastResponseHeaders()
null
for none.
public final GenericUrl buildHttpRequestUrl()
GenericUrl
suitable for use against this service.
GenericUrl
public HttpRequest buildHttpRequest() throws IOException
HttpRequest
suitable for use against this service. Subclasses may override if
specific behavior is required.
HttpRequest
IOException
public HttpResponse executeUnparsed() throws IOException
HttpResponse
. Subclasses may
override if specific behavior is required.
Callers are responsible for closing the response's content input stream by calling
HttpResponse.ignore()
.
HttpResponse
IOException
- if the request failspublic InputStream executeAsInputStream() throws IOException
HttpResponse
.
Subclasses may override if specific behavior is required.
Callers are responsible for closing the input stream.
IOException
- if the request failspublic void download(OutputStream outputStream) throws IOException
HttpResponse
into the given destination output stream.
This method closes the content of the HTTP response from HttpResponse.getContent()
.
outputStream
- destination output stream
IOException
- I/O exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |