org.apache.hc.client5.http.async.methods

## Class SimpleResponseBuilder

- java.lang.Object
- - org.apache.hc.core5.http.support.AbstractMessageBuilder<T>
  - - org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>
    - - org.apache.hc.client5.http.async.methods.SimpleResponseBuilder

-     public class SimpleResponseBuilder
      extends org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>

  Builds `SimpleHttpResponse` instances.
  Since:
    5.1

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SimpleResponseBuilder` | `addHeader(org.apache.hc.core5.http.Header header)`
    `SimpleResponseBuilder` | `addHeader(String name, String value)`
    `SimpleHttpResponse` | `build()`
    `static SimpleResponseBuilder` | `copy(SimpleHttpResponse response)` Copies a source instance into a new one.
    `static SimpleResponseBuilder` | `create(int status)` Creates a new SimpleResponseBuilder with the given status.
    `protected void` | `digest(SimpleHttpResponse response)`
    `SimpleBody` | `getBody()` Gets the body.
    `SimpleResponseBuilder` | `removeHeader(org.apache.hc.core5.http.Header header)`
    `SimpleResponseBuilder` | `removeHeaders(String name)`
    `SimpleResponseBuilder` | `setBody(byte[] content, org.apache.hc.core5.http.ContentType contentType)` Sets the body.
    `SimpleResponseBuilder` | `setBody(SimpleBody body)` Sets the body.
    `SimpleResponseBuilder` | `setBody(String content, org.apache.hc.core5.http.ContentType contentType)` Sets the body.
    `SimpleResponseBuilder` | `setHeader(org.apache.hc.core5.http.Header header)`
    `SimpleResponseBuilder` | `setHeader(String name, String value)`
    `SimpleResponseBuilder` | `setHeaders(org.apache.hc.core5.http.Header... headers)`
    `SimpleResponseBuilder` | `setVersion(org.apache.hc.core5.http.ProtocolVersion version)`
    `String` | `toString()`

    - ### Methods inherited from class org.apache.hc.core5.http.support.AbstractResponseBuilder

      `getStatus, setStatus`

    - ### Methods inherited from class org.apache.hc.core5.http.support.AbstractMessageBuilder

      `digest, getFirstHeader, getFirstHeaders, getHeaders, getHeaders, getLastHeader, getVersion, setHeaders`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### create

          public static SimpleResponseBuilder create(int status)

      Creates a new SimpleResponseBuilder with the given status.
      Parameters:
        `status` - response status.
      Returns:
        a new SimpleResponseBuilder.

    - #### copy

          public static SimpleResponseBuilder copy(SimpleHttpResponse response)

      Copies a source instance into a new one.
      Parameters:
        `response` - the source instance to copy.
      Returns:
        a new SimpleResponseBuilder.

    - #### digest

          protected void digest(SimpleHttpResponse response)

    - #### setVersion

          public SimpleResponseBuilder setVersion(org.apache.hc.core5.http.ProtocolVersion version)

      Overrides:
        `setVersion` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### setHeaders

          public SimpleResponseBuilder setHeaders(org.apache.hc.core5.http.Header... headers)

      Overrides:
        `setHeaders` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### addHeader

          public SimpleResponseBuilder addHeader(org.apache.hc.core5.http.Header header)

      Overrides:
        `addHeader` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### addHeader

          public SimpleResponseBuilder addHeader(String name,
                                                 String value)

      Overrides:
        `addHeader` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### removeHeader

          public SimpleResponseBuilder removeHeader(org.apache.hc.core5.http.Header header)

      Overrides:
        `removeHeader` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### removeHeaders

          public SimpleResponseBuilder removeHeaders(String name)

      Overrides:
        `removeHeaders` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### setHeader

          public SimpleResponseBuilder setHeader(org.apache.hc.core5.http.Header header)

      Overrides:
        `setHeader` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### setHeader

          public SimpleResponseBuilder setHeader(String name,
                                                 String value)

      Overrides:
        `setHeader` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### getBody

          public SimpleBody getBody()

      Gets the body.
      Returns:
        the body.

    - #### setBody

          public SimpleResponseBuilder setBody(SimpleBody body)

      Sets the body.
      Parameters:
        `body` - the body.
      Returns:
        this instance.

    - #### setBody

          public SimpleResponseBuilder setBody(String content,
                                               org.apache.hc.core5.http.ContentType contentType)

      Sets the body.
      Parameters:
        `content` - the body content.
        `contentType` - the body content-type.
      Returns:
        this instance.

    - #### setBody

          public SimpleResponseBuilder setBody(byte[] content,
                                               org.apache.hc.core5.http.ContentType contentType)

      Sets the body.
      Parameters:
        `content` - the body content.
        `contentType` - the body content-type.
      Returns:
        this instance.

    - #### build

          public SimpleHttpResponse build()

      Specified by:
        `build` in class `org.apache.hc.core5.http.support.AbstractResponseBuilder<SimpleHttpResponse>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.