content
null before getContent().Callers should call disconnect() when the HTTP response object is no longer needed.
However, disconnect() does not have to be called if the response stream is properly
closed. Example usage:
HttpResponse response = request.execute();
try {
// process the HTTP response object
} finally {
response.disconnect();
}
Implementation is not thread-safe.
private InputStreamnull before getContent().private static final Stringprivate static final Stringprivate final Stringnull.private intgetContent().private booleanprivate final Stringnull for none.private booleanprivate final HttpMediaTypenull if content-type is null.private final HttpRequest(package private) LowLevelHttpResponseprivate final booleangetContent() should return raw input stream.private final intprivate final Stringnull.voidLowLevelHttpResponse.disconnect(), then close the HTTP response
content using ignore().voiddownload(OutputStream outputStream) Charset specified in the Content-Type of this response or the ISO-8859-1
charset as a default.null for none.intgetContent().null for none.HttpMediaType or null if no
content-type was set.int0 for none.null for none.private booleanignore() if false.voidignore()getContent(), ignoring any content.booleanboolean>= 200 && < 300 (see getStatusCode()).<T> TgetContent() and reads it into a data
class of key/value pairs using the parser returned by HttpRequest.getParser().getContent() and reads it into a data
type of key/value pairs using the parser returned by HttpRequest.getParser().getContent() and reads it into a string.private static HttpMediaTypeparseMediaType(String contentType) HttpMediaType object parsed from contentType, or null if if
contentType cannot be parsed or contentType is null.setContentLoggingLimit(int contentLoggingLimit) getContent().setLoggingEnabled(boolean loggingEnabled) null before getContent().null.null for none.null if content-type is null.null.getContent() should return raw input stream.getContent().
Content will only be logged if isLoggingEnabled() is true.
If the content size is greater than this limit then it will not be logged.
Can be set to 0 to disable content logging. This is useful for example if content
has sensitive data such as authentication information.
Defaults to HttpRequest.getContentLoggingLimit().
Defaults to HttpRequest.isLoggingEnabled().
IOExceptionHttpMediaType object parsed from contentType, or null if if
contentType cannot be parsed or contentType is null.getContent().
Content will only be logged if isLoggingEnabled() is true.
If the content size is greater than this limit then it will not be logged.
Can be set to 0 to disable content logging. This is useful for example if content
has sensitive data such as authentication information.
Defaults to HttpRequest.getContentLoggingLimit().
getContent().
Content will only be logged if isLoggingEnabled() is true.
If the content size is greater than this limit then it will not be logged.
Can be set to 0 to disable content logging. This is useful for example if content
has sensitive data such as authentication information.
Defaults to HttpRequest.getContentLoggingLimit().
Defaults to HttpRequest.isLoggingEnabled().
Defaults to HttpRequest.isLoggingEnabled().
HttpMediaType or null if no
content-type was set.>= 200 && < 300 (see getStatusCode()).0 for none.The result is cached, so subsequent calls will be fast.
Callers should call InputStream.close() after the returned InputStream is no
longer needed. Example usage:
InputStream is = response.getContent();
try {
// Process the input stream..
} finally {
is.close();
}
disconnect() does not have to be called if the content is closed.
null for noneIOException - I/O exceptionSample usage:
HttpRequest request = requestFactory.buildGetRequest(
new GenericUrl("https://www.google.com/images/srpr/logo3w.png"));
OutputStream outputStream = new FileOutputStream(new File("/tmp/logo3w.png"));
try {
HttpResponse response = request.execute();
response.download(outputStream);
} finally {
outputStream.close();
}
This method closes the content of the HTTP response from getContent().
This method does not close the given output stream.
outputStream - destination output streamIOException - I/O exceptiongetContent(), ignoring any content.IOExceptionLowLevelHttpResponse.disconnect(), then close the HTTP response
content using ignore().IOExceptiongetContent() and reads it into a data
class of key/value pairs using the parser returned by HttpRequest.getParser().
Reference: http://tools.ietf.org/html/rfc2616#section-4.3
null for no contentIOExceptionignore() if false.IOExceptiongetContent() and reads it into a data
type of key/value pairs using the parser returned by HttpRequest.getParser().null for no contentIOExceptiongetContent() and reads it into a string.
Since this method returns "" for no content, a simpler check for no content is to
check if getContent() is null.
All content is read from the input content stream rather than being limited by the
Content-Length. For the character set, it follows the specification by parsing the "charset"
parameter of the Content-Type header or by default "ISO-8859-1" if the parameter is
missing.
"" for no contentIOException - I/O exception