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