public final class SimpleHttpResponse
extends BasicHttpResponse
IMPORTANT: SimpleHttpResponses are intended for simple scenarios where entities inclosed
in responses are known to be small. It is generally recommended to use streaming
org.apache.hc.core5.http.nio.AsyncResponseConsumers, for instance, such as based on
AbstractCharResponseConsumer or AbstractBinResponseConsumer.
SimpleBody,
AbstractCharResponseConsumer,
AbstractBinResponseConsumer| Constructor and Description |
|---|
SimpleHttpResponse(int code) |
SimpleHttpResponse(int code,
java.lang.String reasonPhrase) |
| Modifier and Type | Method and Description |
|---|---|
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,
java.lang.String content) |
static SimpleHttpResponse |
create(int code,
java.lang.String content,
ContentType contentType) |
SimpleBody |
getBody() |
byte[] |
getBodyBytes() |
java.lang.String |
getBodyText() |
ContentType |
getContentType() |
void |
setBody(byte[] bodyBytes,
ContentType contentType) |
void |
setBody(SimpleBody body) |
void |
setBody(java.lang.String bodyText,
ContentType contentType) |
public SimpleHttpResponse(int code)
public SimpleHttpResponse(int code,
java.lang.String reasonPhrase)
public static SimpleHttpResponse copy(HttpResponse original)
public static SimpleHttpResponse create(int code)
public static SimpleHttpResponse create(int code, java.lang.String content, ContentType contentType)
public static SimpleHttpResponse create(int code, java.lang.String content)
public static SimpleHttpResponse create(int code, byte[] content, ContentType contentType)
public static SimpleHttpResponse create(int code, byte[] content)
public void setBody(SimpleBody body)
public void setBody(byte[] bodyBytes,
ContentType contentType)
public void setBody(java.lang.String bodyText,
ContentType contentType)
public SimpleBody getBody()
public ContentType getContentType()
public java.lang.String getBodyText()
public byte[] getBodyBytes()