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:
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: 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.

Since:
5.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private SimpleBody
     
    private static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SimpleHttpResponse(int code, String reasonPhrase)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    copy(org.apache.hc.core5.http.HttpResponse original)
     
    create(int code)
     
    create(int code, byte[] content)
     
    create(int code, byte[] content, org.apache.hc.core5.http.ContentType contentType)
     
    create(int code, String content)
     
    create(int code, String content, org.apache.hc.core5.http.ContentType contentType)
     
     
    byte[]
     
     
    org.apache.hc.core5.http.ContentType
     
    void
    setBody(byte[] bodyBytes, org.apache.hc.core5.http.ContentType contentType)
     
    void
    setBody(String bodyText, org.apache.hc.core5.http.ContentType contentType)
     
    void
     

    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, removeHeader, removeHeaders, setHeader, setHeaders

    Methods inherited from interface org.apache.hc.core5.http.MessageHeaders

    containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator
  • Field Details

  • Constructor Details

    • SimpleHttpResponse

      public SimpleHttpResponse(int code)
    • SimpleHttpResponse

      public SimpleHttpResponse(int code, String reasonPhrase)
  • Method Details

    • 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, String content, org.apache.hc.core5.http.ContentType contentType)
    • create

      public static SimpleHttpResponse create(int code, 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(String bodyText, org.apache.hc.core5.http.ContentType contentType)
    • getBody

      public SimpleBody getBody()
    • getContentType

      public org.apache.hc.core5.http.ContentType getContentType()
    • getBodyText

      public String getBodyText()
    • getBodyBytes

      public byte[] getBodyBytes()