Package com.luna.common.net.async
Class CustomAsyncHttpResponse
java.lang.Object
org.apache.hc.core5.http.message.HeaderGroup
org.apache.hc.core5.http.message.BasicHttpResponse
org.apache.hc.core5.http.message.BasicClassicHttpResponse
com.luna.common.net.async.CustomAsyncHttpResponse
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,org.apache.hc.core5.http.ClassicHttpResponse
,org.apache.hc.core5.http.HttpEntityContainer
,org.apache.hc.core5.http.HttpMessage
,org.apache.hc.core5.http.HttpResponse
,org.apache.hc.core5.http.MessageHeaders
public final class CustomAsyncHttpResponse
extends org.apache.hc.core5.http.message.BasicClassicHttpResponse
HTTP response that can enclose a body represented as a simple text string or an array of bytes.
IMPORTANT: CustomAsyncHttpResponse
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
ConstructorDescriptionCustomAsyncHttpResponse
(int code) CustomAsyncHttpResponse
(int code, String reasonPhrase) -
Method Summary
Modifier and TypeMethodDescriptionstatic CustomAsyncHttpResponse
copy
(org.apache.hc.core5.http.HttpResponse original) static CustomAsyncHttpResponse
create
(int code) static CustomAsyncHttpResponse
create
(int code, byte[] content) static CustomAsyncHttpResponse
create
(int code, byte[] content, org.apache.hc.core5.http.ContentType contentType) static CustomAsyncHttpResponse
static CustomAsyncHttpResponse
getBody()
byte[]
org.apache.hc.core5.http.ContentType
void
setBody
(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType) void
setBody
(CustomResponseBody body) void
Methods inherited from class org.apache.hc.core5.http.message.BasicClassicHttpResponse
close, getEntity, setEntity
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, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion
Methods inherited from interface org.apache.hc.core5.http.HttpResponse
getCode, getLocale, getReasonPhrase, setCode, setLocale, setReasonPhrase
Methods inherited from interface org.apache.hc.core5.http.MessageHeaders
containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
-
Constructor Details
-
CustomAsyncHttpResponse
public CustomAsyncHttpResponse(int code) -
CustomAsyncHttpResponse
-
-
Method Details
-
copy
-
create
-
create
public static CustomAsyncHttpResponse create(int code, String content, org.apache.hc.core5.http.ContentType contentType) -
create
-
create
public static CustomAsyncHttpResponse create(int code, byte[] content, org.apache.hc.core5.http.ContentType contentType) -
create
-
setBody
public void setBody(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType) -
setBody
-
getBody
-
setBody
-
getContentType
public org.apache.hc.core5.http.ContentType getContentType() -
getBodyText
-
getBodyBytes
public byte[] getBodyBytes()
-