public final class SimpleHttpResponse
extends org.apache.hc.core5.http.message.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
AsyncResponseConsumers, for instance, such as based on
AbstractCharResponseConsumer or AbstractBinResponseConsumer.
SimpleBody,
AbstractCharResponseConsumer,
AbstractBinResponseConsumer,
Serialized Form| Constructor and Description |
|---|
SimpleHttpResponse(int code) |
SimpleHttpResponse(int code,
String reasonPhrase) |
| Modifier and Type | Method and Description |
|---|---|
static SimpleHttpResponse |
copy(org.apache.hc.core5.http.HttpResponse original) |
static SimpleHttpResponse |
create(int code) |
static SimpleHttpResponse |
create(int code,
byte[] content) |
static SimpleHttpResponse |
create(int code,
byte[] content,
org.apache.hc.core5.http.ContentType contentType) |
static SimpleHttpResponse |
create(int code,
String content) |
static SimpleHttpResponse |
create(int code,
String content,
org.apache.hc.core5.http.ContentType contentType) |
SimpleBody |
getBody() |
byte[] |
getBodyBytes() |
String |
getBodyText() |
org.apache.hc.core5.http.ContentType |
getContentType() |
void |
setBody(byte[] bodyBytes,
org.apache.hc.core5.http.ContentType contentType) |
void |
setBody(SimpleBody body) |
void |
setBody(String bodyText,
org.apache.hc.core5.http.ContentType contentType) |
addHeader, getCode, getLocale, getReason, getReasonPhrase, getVersion, setCode, setHeader, setLocale, setReasonPhrase, setVersion, toStringaddHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeadersclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic SimpleHttpResponse(int code)
public SimpleHttpResponse(int code,
String reasonPhrase)
public static SimpleHttpResponse copy(org.apache.hc.core5.http.HttpResponse original)
public static SimpleHttpResponse create(int code)
public static SimpleHttpResponse create(int code, String content, org.apache.hc.core5.http.ContentType contentType)
public static SimpleHttpResponse create(int code, String content)
public static SimpleHttpResponse create(int code, byte[] content, org.apache.hc.core5.http.ContentType contentType)
public static SimpleHttpResponse create(int code, byte[] content)
public void setBody(SimpleBody body)
public void setBody(byte[] bodyBytes,
org.apache.hc.core5.http.ContentType contentType)
public void setBody(String bodyText, org.apache.hc.core5.http.ContentType contentType)
public SimpleBody getBody()
public org.apache.hc.core5.http.ContentType getContentType()
public String getBodyText()
public byte[] getBodyBytes()
Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.