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:
java.io.Serializable
,org.apache.hc.core5.http.HttpMessage
,org.apache.hc.core5.http.HttpResponse
,org.apache.hc.core5.http.MessageHeaders
public final class SimpleHttpResponse extends org.apache.hc.core5.http.message.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 streamingAsyncResponseConsumer
s, for instance, such as based onAbstractCharResponseConsumer
orAbstractBinResponseConsumer
.- Since:
- 5.0
- See Also:
SimpleBody
,AbstractCharResponseConsumer
,AbstractBinResponseConsumer
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleBody
body
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description SimpleHttpResponse(int code)
SimpleHttpResponse(int code, java.lang.String reasonPhrase)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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, java.lang.String content)
static SimpleHttpResponse
create(int code, java.lang.String content, org.apache.hc.core5.http.ContentType contentType)
SimpleBody
getBody()
byte[]
getBodyBytes()
java.lang.String
getBodyText()
org.apache.hc.core5.http.ContentType
getContentType()
void
setBody(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType)
void
setBody(java.lang.String bodyText, org.apache.hc.core5.http.ContentType contentType)
void
setBody(SimpleBody body)
-
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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
body
private SimpleBody body
-
-
Method Detail
-
copy
public static SimpleHttpResponse copy(org.apache.hc.core5.http.HttpResponse original)
-
create
public static SimpleHttpResponse create(int code)
-
create
public static SimpleHttpResponse create(int code, java.lang.String content, org.apache.hc.core5.http.ContentType contentType)
-
create
public static SimpleHttpResponse create(int code, java.lang.String content)
-
create
public static SimpleHttpResponse create(int code, byte[] content, org.apache.hc.core5.http.ContentType contentType)
-
create
public static SimpleHttpResponse create(int code, byte[] content)
-
setBody
public void setBody(SimpleBody body)
-
setBody
public void setBody(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType)
-
setBody
public void setBody(java.lang.String bodyText, org.apache.hc.core5.http.ContentType contentType)
-
getBody
public SimpleBody getBody()
-
getContentType
public org.apache.hc.core5.http.ContentType getContentType()
-
getBodyText
public java.lang.String getBodyText()
-
getBodyBytes
public byte[] getBodyBytes()
-
-