org.apache.hc.core5.http.message

## Class BasicClassicHttpResponse

- java.lang.Object
- - org.apache.hc.core5.http.message.HeaderGroup
  - - org.apache.hc.core5.http.message.BasicHttpResponse
    - - org.apache.hc.core5.http.message.BasicClassicHttpResponse

- All Implemented Interfaces:
    Closeable, Serializable, AutoCloseable, ClassicHttpResponse, HttpEntityContainer, HttpMessage, HttpResponse, MessageHeaders

      public class BasicClassicHttpResponse
      extends BasicHttpResponse
      implements ClassicHttpResponse

  Basic implementation of `ClassicHttpResponse`.
  Since:
    5.0
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicClassicHttpResponse(int code)` Creates a new response.
    `BasicClassicHttpResponse(int code, ReasonPhraseCatalog catalog, Locale locale)` Creates a new response.
    `BasicClassicHttpResponse(int code, String reasonPhrase)` Creates a new response.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `HttpEntity` | `getEntity()` Obtains the message entity, if available.
    `void` | `setEntity(HttpEntity entity)` Sets an entity for this message.

    - ### 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.HttpResponse

      `getCode, getLocale, getReasonPhrase, setCode, setLocale, setReasonPhrase`

    - ### 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.MessageHeaders

      `containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator`

- - ### Constructor Detail

    - #### BasicClassicHttpResponse

          public BasicClassicHttpResponse(int code,
                                  ReasonPhraseCatalog catalog,
                                  Locale locale)

      Creates a new response.
      Parameters:
        `code` - the status code
        `catalog` - the reason phrase catalog, or `null` to disable automatic reason phrase lookup
        `locale` - the locale for looking up reason phrases, or `null` for the system locale

    - #### BasicClassicHttpResponse

          public BasicClassicHttpResponse(int code,
                                  String reasonPhrase)

      Creates a new response.
      Parameters:
        `code` - the status code of the response
        `reasonPhrase` - the reason phrase to the status code, or `null`

    - #### BasicClassicHttpResponse

          public BasicClassicHttpResponse(int code)

      Creates a new response.
      Parameters:
        `code` - the status code of the response

  - ### Method Detail

    - #### getEntity

          public HttpEntity getEntity()

      Description copied from interface: `HttpEntityContainer`
      Obtains the message entity, if available.
      Specified by:
        `getEntity` in interface `HttpEntityContainer`
      Returns:
        the message entity, or `null` if not available

    - #### setEntity

          public void setEntity(HttpEntity entity)

      Description copied from interface: `HttpEntityContainer`
      Sets an entity for this message.

      Please note that if an entity has already been set it is responsibility of the caller to ensure release of the resources that may be associated with that entity.

      Specified by:
        `setEntity` in interface `HttpEntityContainer`
      Parameters:
        `entity` - the entity to set of this message, or `null` to unset

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.