public class HTTPResponse
extends java.lang.Object
implements java.io.Serializable
HTTPResponse
encapsulates the results of a HTTPRequest
made via the URLFetchService
.Constructor and Description |
---|
HTTPResponse(int responseCode,
byte[] content,
java.net.URL finalUrl,
java.util.List<HTTPHeader> headers)
Construct an HTTPResponse object.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getContent()
Returns the content of the request, or null if there is no
content present (e.g.
|
java.net.URL |
getFinalUrl()
Returns the final URL the content came from if redirects were followed
automatically in the request, if different than the input URL; otherwise
this will be null.
|
java.util.List<HTTPHeader> |
getHeaders()
Returns a
List of HTTP response headers that were
returned by the remote server. |
java.util.List<HTTPHeader> |
getHeadersUncombined()
Returns a
List of HTTP response headers that were
returned by the remote server. |
int |
getResponseCode()
Returns the HTTP response code from the request (e.g.
|
public HTTPResponse(int responseCode, byte[] content, java.net.URL finalUrl, java.util.List<HTTPHeader> headers)
responseCode
- the HTTP response codecontent
- the HTTP response content (can be null)finalUrl
- the URL that served the request if redirection was followed (can be null)headers
- the HTTP response headerspublic int getResponseCode()
public byte[] getContent()
public java.net.URL getFinalUrl()
public java.util.List<HTTPHeader> getHeadersUncombined()
List
of HTTP response headers that were
returned by the remote server. These are not combined for
repeated values.public java.util.List<HTTPHeader> getHeaders()
List
of HTTP response headers that were
returned by the remote server. Multi-valued headers are
represented as a single HTTPHeader
with comma-separated
values.