|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.client.http.HttpResponse
public final class HttpResponse
HTTP response.
| Field Summary | |
|---|---|
String |
contentEncoding
Content encoding or null. |
String |
contentType
Content type or null for none. |
boolean |
disableContentLogging
Whether to disable response content logging during getContent()
(unless Level.ALL is loggable which forces all logging). |
HttpHeaders |
headers
HTTP headers. |
boolean |
isSuccessStatusCode
Whether received a successful status code >= 200 && < 300. |
int |
statusCode
Status code. |
String |
statusMessage
Status message or null. |
HttpTransport |
transport
HTTP transport. |
| Method Summary | ||
|---|---|---|
InputStream |
getContent()
Returns the content of the HTTP response. |
|
HttpParser |
getParser()
Returns the HTTP response content parser to use for the content type of this HTTP response or null for none. |
|
void |
ignore()
Gets the content of the HTTP response from getContent() and
ignores the content if there is any. |
|
static boolean |
isSuccessStatusCode(int statusCode)
Returns whether the given HTTP response status code is a success code >= 200 and < 300. |
|
|
parseAs(Class<T> dataClass)
Parses the content of the HTTP response from getContent() and
reads it into a data class of key/value pairs using the parser returned by
getParser() . |
|
String |
parseAsString()
Parses the content of the HTTP response from getContent() and
reads it into a string. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final String contentEncoding
null.
public final String contentType
null for none.
public final HttpHeaders headers
If a header name is used for multiple headers, only the last one is retained.
This field's value is instantiated using the same class as that of the
HttpTransport.defaultHeaders.
public final boolean isSuccessStatusCode
>= 200 && < 300.
public final int statusCode
public final String statusMessage
null.
public final HttpTransport transport
public boolean disableContentLogging
getContent()
(unless Level.ALL is loggable which forces all logging).
Useful for example if content has sensitive data such as an authentication
token. Defaults to false.
| Method Detail |
|---|
public InputStream getContent()
throws IOException
The result is cached, so subsequent calls will be fast.
null for none
IOException - I/O exception
public void ignore()
throws IOException
getContent() and
ignores the content if there is any.
IOException - I/O exceptionpublic HttpParser getParser()
null for none.
public <T> T parseAs(Class<T> dataClass)
throws IOException
getContent() and
reads it into a data class of key/value pairs using the parser returned by
getParser() .
null for no content
IOException - I/O exception
IllegalArgumentException - if no parser is defined for the given
content type or if there is no content type defined in the HTTP
response
public String parseAsString()
throws IOException
getContent() and
reads it into a string.
Upgrade warning: in version 2.2 of gdata-java-client library, this method
returned null for no content. However, in version 1.0 of this
library it now returns "". To check for no content, check if
getContent() is null.
"" for no content
IOException - I/O exceptionpublic static boolean isSuccessStatusCode(int statusCode)
>= 200 and < 300.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||