com.google.appengine.api.urlfetch
Class HTTPResponse
- java.lang.Object
-
- com.google.appengine.api.urlfetch.HTTPResponse
-
- All Implemented Interfaces:
- java.io.Serializable
public class HTTPResponse extends java.lang.Object implements java.io.Serializable
HTTPResponse
encapsulates the results of aHTTPRequest
made via theURLFetchService
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HTTPResponse(int responseCode, byte[] content, java.net.URL finalUrl, java.util.List<HTTPHeader> headers)
Construct an HTTPResponse object.
-
Method Summary
All Methods Instance Methods Concrete Methods 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 aList
of HTTP response headers that were returned by the remote server.java.util.List<HTTPHeader>
getHeadersUncombined()
Returns aList
of HTTP response headers that were returned by the remote server.int
getResponseCode()
Returns the HTTP response code from the request (e.g.
-
-
-
Constructor Detail
-
HTTPResponse
public HTTPResponse(int responseCode, byte[] content, java.net.URL finalUrl, java.util.List<HTTPHeader> headers)
Construct an HTTPResponse object.- Parameters:
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 headers
-
-
Method Detail
-
getResponseCode
public int getResponseCode()
Returns the HTTP response code from the request (e.g. 200, 500, etc.).
-
getContent
public byte[] getContent()
Returns the content of the request, or null if there is no content present (e.g. in a HEAD request).
-
getFinalUrl
public 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.
-
getHeadersUncombined
public java.util.List<HTTPHeader> getHeadersUncombined()
Returns aList
of HTTP response headers that were returned by the remote server. These are not combined for repeated values.
-
getHeaders
public java.util.List<HTTPHeader> getHeaders()
Returns aList
of HTTP response headers that were returned by the remote server. Multi-valued headers are represented as a singleHTTPHeader
with comma-separated values.
-
-