T
- type of the responsepublic abstract class AbstractGoogleJsonClientRequest<T> extends AbstractGoogleClientRequest<T>
AbstractGoogleJsonClient
.
Implementation is not thread-safe.
com.google.api.client.util.GenericData.Flags
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
USER_AGENT_SUFFIX
Modifier | Constructor and Description |
---|---|
protected |
AbstractGoogleJsonClientRequest(AbstractGoogleJsonClient abstractGoogleJsonClient,
String requestMethod,
String uriTemplate,
Object jsonContent,
Class<T> responseClass) |
Modifier and Type | Method and Description |
---|---|
AbstractGoogleJsonClient |
getAbstractGoogleClient()
Returns the Google client.
|
Object |
getJsonContent()
Returns POJO that can be serialized into JSON content or
null for none. |
protected GoogleJsonResponseException |
newExceptionOnError(com.google.api.client.http.HttpResponse response)
Returns the exception to throw on an HTTP error response as defined by
HttpResponse.isSuccessStatusCode() . |
void |
queue(BatchRequest batchRequest,
JsonBatchCallback<T> callback)
Queues the request into the specified batch request container.
|
AbstractGoogleJsonClientRequest<T> |
set(String fieldName,
Object value) |
AbstractGoogleJsonClientRequest<T> |
setDisableGZipContent(boolean disableGZipContent)
Sets whether to disable GZip compression of HTTP content.
|
AbstractGoogleJsonClientRequest<T> |
setRequestHeaders(com.google.api.client.http.HttpHeaders headers)
Sets the HTTP headers used for the Google client request.
|
buildHttpRequest, buildHttpRequestUrl, buildHttpRequestUsingHead, checkRequiredParameter, execute, executeAndDownloadTo, executeAsInputStream, executeMedia, executeMediaAndDownloadTo, executeMediaAsInputStream, executeUnparsed, executeUsingHead, getDisableGZipContent, getHttpContent, getLastResponseHeaders, getLastStatusCode, getLastStatusMessage, getMediaHttpDownloader, getMediaHttpUploader, getRequestHeaders, getRequestMethod, getResponseClass, getUriTemplate, initializeMediaDownload, initializeMediaUpload, queue
clone, entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys, toString
clear, containsKey, containsValue, isEmpty, keySet, size, values
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
protected AbstractGoogleJsonClientRequest(AbstractGoogleJsonClient abstractGoogleJsonClient, String requestMethod, String uriTemplate, Object jsonContent, Class<T> responseClass)
abstractGoogleJsonClient
- Google JSON clientrequestMethod
- HTTP MethoduriTemplate
- URI template for the path relative to the base URL. 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)
jsonContent
- POJO that can be serialized into JSON content or null
for noneresponseClass
- response class to parse intopublic AbstractGoogleJsonClient getAbstractGoogleClient()
AbstractGoogleClientRequest
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
getAbstractGoogleClient
in class AbstractGoogleClientRequest<T>
public AbstractGoogleJsonClientRequest<T> setDisableGZipContent(boolean disableGZipContent)
AbstractGoogleClientRequest
By default it is false
.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
setDisableGZipContent
in class AbstractGoogleClientRequest<T>
public AbstractGoogleJsonClientRequest<T> setRequestHeaders(com.google.api.client.http.HttpHeaders headers)
AbstractGoogleClientRequest
These headers are set on the request after AbstractGoogleClientRequest.buildHttpRequest()
is called, this means that
HttpRequestInitializer.initialize(com.google.api.client.http.HttpRequest)
is called first.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
setRequestHeaders
in class AbstractGoogleClientRequest<T>
public final void queue(BatchRequest batchRequest, JsonBatchCallback<T> callback) throws IOException
Batched requests are then executed when BatchRequest.execute()
is called.
Example usage:
request.queue(batchRequest, new JsonBatchCallback<SomeResponseType>() { public void onSuccess(SomeResponseType content, HttpHeaders responseHeaders) { log("Success"); } public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) { log(e.getMessage()); } });
batchRequest
- batch request containercallback
- batch callbackIOException
protected GoogleJsonResponseException newExceptionOnError(com.google.api.client.http.HttpResponse response)
AbstractGoogleClientRequest
HttpResponse.isSuccessStatusCode()
.
It is guaranteed that HttpResponse.isSuccessStatusCode()
is false
. Default
implementation is to call HttpResponseException.HttpResponseException(HttpResponse)
,
but subclasses may override.
newExceptionOnError
in class AbstractGoogleClientRequest<T>
response
- HTTP responsepublic Object getJsonContent()
null
for none.public AbstractGoogleJsonClientRequest<T> set(String fieldName, Object value)
set
in class AbstractGoogleClientRequest<T>
Copyright © 2010–2019 Google. All rights reserved.