org.apache.hc.client5.http.async.methods

## Class SimpleHttpResponse

- java.lang.Object
- - org.apache.hc.core5.http.message.HeaderGroup
  - - org.apache.hc.core5.http.message.BasicHttpResponse
    - - org.apache.hc.client5.http.async.methods.SimpleHttpResponse

All Implemented Interfaces:
  Serializable, HttpMessage, HttpResponse, MessageHeaders

    public final class SimpleHttpResponse
    extends BasicHttpResponse

HTTP response that can enclose a body represented as a simple text string or an array of bytes.

IMPORTANT: `SimpleHttpResponse`s are intended for simple scenarios where entities inclosed in responses are known to be small. It is generally recommended to use streaming `AsyncResponseConsumer`s, for instance, such as based on `AbstractCharResponseConsumer` or `AbstractBinResponseConsumer`.

Since:
  5.0
See Also:
  `SimpleBody`, `AbstractCharResponseConsumer`, `AbstractBinResponseConsumer`, Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`SimpleHttpResponse(int code)`
`SimpleHttpResponse(int code, String reasonPhrase)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static SimpleHttpResponse` `copy(HttpResponse original)`
`static SimpleHttpResponse` `create(int code)`
`static SimpleHttpResponse` `create(int code, byte[] content)`
`static SimpleHttpResponse` `create(int code, byte[] content, ContentType contentType)`
`static SimpleHttpResponse` `create(int code, String content)`
`static SimpleHttpResponse` `create(int code, String content, ContentType contentType)`
`SimpleBody` `getBody()`
`byte[]` `getBodyBytes()`
`String` `getBodyText()`
`ContentType` `getContentType()`
`void` `setBody(byte[] bodyBytes, ContentType contentType)`
`void` `setBody(SimpleBody body)`
`void` `setBody(String bodyText, ContentType contentType)`

### Methods inherited from class org.apache.hc.core5.http.message.BasicHttpResponse

`addHeader, getCode, getLocale, getReason, getReasonPhrase, getVersion, setCode, setHeader, setLocale, setReasonPhrase, setVersion, toString`

### Methods inherited from class org.apache.hc.core5.http.message.HeaderGroup

`addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.hc.core5.http.HttpMessage

`addHeader, removeHeader, removeHeaders, setHeader, setHeaders`

### Methods inherited from interface org.apache.hc.core5.http.MessageHeaders

`containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator`

### Constructor Detail

#### SimpleHttpResponse

    public SimpleHttpResponse(int code)

#### SimpleHttpResponse

    public SimpleHttpResponse(int code,
                              String reasonPhrase)

### Method Detail

#### copy

    public static SimpleHttpResponse copy(HttpResponse original)

#### create

    public static SimpleHttpResponse create(int code)

#### create

    public static SimpleHttpResponse create(int code,
                                            String content,
                                            ContentType contentType)

#### create

    public static SimpleHttpResponse create(int code,
                                            String content)

#### create

    public static SimpleHttpResponse create(int code,
                                            byte[] content,
                                            ContentType contentType)

#### create

    public static SimpleHttpResponse create(int code,
                                            byte[] content)

#### setBody

    public void setBody(SimpleBody body)

#### setBody

    public void setBody(byte[] bodyBytes,
                        ContentType contentType)

#### setBody

    public void setBody(String bodyText,
                        ContentType contentType)

#### getBody

    public SimpleBody getBody()

#### getContentType

    public ContentType getContentType()

#### getBodyText

    public String getBodyText()

#### getBodyBytes

    public byte[] getBodyBytes()