# Class HTTPResponse (5.0.3)

    public class HTTPResponse implements Serializable

`HTTPResponse` encapsulates the results of a `
HTTPRequest` made via the `URLFetchService`.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> HTTPResponse

## Implements

[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### HTTPResponse(int responseCode, byte @Nullable \[\] content, @Nullable URL finalUrl, List\<HTTPHeader\> headers)

    public HTTPResponse(int responseCode, byte @Nullable [] content, @Nullable URL finalUrl, List<HTTPHeader> headers)

Construct an HTTPResponse object.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `responseCode` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the HTTP response code |
| `content` | `byte @org.jspecify.annotations.Nullable []` the HTTP response content (can be null) |
| `finalUrl` | `https://docs.oracle.com/javase/8/docs/api/java/net/@org/jspecify/annotations/Nullable URL.html` the URL that served the request if redirection was followed (can be null) |
| `headers` | `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.HTTPHeader>` the HTTP response headers |

## Methods

### 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).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `byte @org.jspecify.annotations.Nullable []` |   |

### 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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/net/@org/jspecify/annotations/Nullable URL.html` |   |

### getHeaders()

    public List<HTTPHeader> getHeaders()

Returns a `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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.HTTPHeader>` |   |

### getHeadersUncombined()

    public List<HTTPHeader> getHeadersUncombined()

Returns a `List` of HTTP response headers that were
returned by the remote server. These are not combined for
repeated values.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.urlfetch.HTTPHeader>` |   |

### getResponseCode()

    public int getResponseCode()

Returns the HTTP response code from the request (e.g. 200, 500,
etc.).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |