public final class SimpleHttpResponse
extends org.apache.hc.core5.http.message.BasicHttpResponse
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
.
SimpleBody
,
AbstractCharResponseConsumer
,
AbstractBinResponseConsumer
,
Serialized FormConstructor 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, toString
addHeader, clear, containsHeader, countHeaders, getCondensedHeader, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, removeHeaders, setHeader, setHeaders
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public 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–2021 The Apache Software Foundation. All rights reserved.