Top Description Fields Constructors Methods
org.apache.hc.client5.http.async.methods

public final Class SimpleHttpResponse

extends BasicHttpResponse
Class Inheritance
Imports
java.util.Iterator, org.apache.hc.core5.http.ContentType, .Header, .HttpResponse, org.apache.hc.core5.http.message.BasicHttpResponse, org.apache.hc.core5.util.Args

HTTP response that can enclose a body represented as a simple text string or an array of bytes.

Important Note

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.

Since
5.0
See Also
SimpleBody, AbstractCharResponseConsumer, AbstractBinResponseConsumer

Field Summary

Modifier and TypeField and Description
private SimpleBody
private static final long

Constructor Summary

AccessConstructor and Description
public
SimpleHttpResponse(final int code)

public
SimpleHttpResponse(final int code, final String reasonPhrase)

Method Summary

Modifier and TypeMethod and Description
public static SimpleHttpResponse
copy(final HttpResponse original)

public static SimpleHttpResponse
create(final int code)

public static SimpleHttpResponse
create(final int code, final String content, final ContentType contentType)

public static SimpleHttpResponse
create(final int code, final String content)

public static SimpleHttpResponse
create(final int code, final byte[] content, final ContentType contentType)

public static SimpleHttpResponse
create(final int code, final byte[] content)

public SimpleBody
public byte[]
public String
public ContentType
public void
setBody(final SimpleBody body)

public void
setBody(final byte[] bodyBytes, final ContentType contentType)

public void
setBody(final String bodyText, final ContentType contentType)

Inherited from org.apache.hc.core5.http.message.BasicHttpResponse:
addHeadergetCodegetLocalegetReasongetReasonPhrasegetVersionsetCodesetHeadersetLocalesetReasonPhrasesetVersiontoString

Field Detail

bodyback to summary
private SimpleBody body
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.hc.core5.http.message.BasicHttpResponse.serialVersionUID.

Constructor Detail

SimpleHttpResponseback to summary
public SimpleHttpResponse(final int code)
SimpleHttpResponseback to summary
public SimpleHttpResponse(final int code, final String reasonPhrase)

Method Detail

copyback to summary
public static SimpleHttpResponse copy(final HttpResponse original)
createback to summary
public static SimpleHttpResponse create(final int code)
createback to summary
public static SimpleHttpResponse create(final int code, final String content, final ContentType contentType)
createback to summary
public static SimpleHttpResponse create(final int code, final String content)
createback to summary
public static SimpleHttpResponse create(final int code, final byte[] content, final ContentType contentType)
createback to summary
public static SimpleHttpResponse create(final int code, final byte[] content)
getBodyback to summary
public SimpleBody getBody()
getBodyBytesback to summary
public byte[] getBodyBytes()
getBodyTextback to summary
public String getBodyText()
getContentTypeback to summary
public ContentType getContentType()
setBodyback to summary
public void setBody(final SimpleBody body)
setBodyback to summary
public void setBody(final byte[] bodyBytes, final ContentType contentType)
setBodyback to summary
public void setBody(final String bodyText, final ContentType contentType)