org.apache.hc.client5.http.impl.classic

## Class CloseableHttpResponse

- java.lang.Object
- - org.apache.hc.client5.http.impl.classic.CloseableHttpResponse

- All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.hc.core5.http.ClassicHttpResponse, org.apache.hc.core5.http.HttpEntityContainer, org.apache.hc.core5.http.HttpMessage, org.apache.hc.core5.http.HttpResponse, org.apache.hc.core5.http.MessageHeaders

      public final class CloseableHttpResponse
      extends Object
      implements org.apache.hc.core5.http.ClassicHttpResponse

  Provided for backward compatibility with HttpClient 4.x.
  Since:
    4.3

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHeader(org.apache.hc.core5.http.Header header)`
    `void` | `addHeader(String name, Object value)`
    `void` | `close()`
    `boolean` | `containsHeader(String name)`
    `int` | `countHeaders(String name)`
    `int` | `getCode()`
    `org.apache.hc.core5.http.HttpEntity` | `getEntity()`
    `org.apache.hc.core5.http.Header` | `getFirstHeader(String name)`
    `org.apache.hc.core5.http.Header` | `getHeader(String name)`
    `org.apache.hc.core5.http.Header[]` | `getHeaders()`
    `org.apache.hc.core5.http.Header[]` | `getHeaders(String name)`
    `org.apache.hc.core5.http.Header` | `getLastHeader(String name)`
    `Locale` | `getLocale()`
    `String` | `getReasonPhrase()`
    `org.apache.hc.core5.http.ProtocolVersion` | `getVersion()`
    `Iterator<org.apache.hc.core5.http.Header>` | `headerIterator()`
    `Iterator<org.apache.hc.core5.http.Header>` | `headerIterator(String name)`
    `boolean` | `removeHeader(org.apache.hc.core5.http.Header header)`
    `boolean` | `removeHeaders(String name)`
    `void` | `setCode(int code)`
    `void` | `setEntity(org.apache.hc.core5.http.HttpEntity entity)`
    `void` | `setHeader(org.apache.hc.core5.http.Header header)`
    `void` | `setHeader(String name, Object value)`
    `void` | `setHeaders(org.apache.hc.core5.http.Header... headers)`
    `void` | `setLocale(Locale loc)`
    `void` | `setReasonPhrase(String reason)`
    `void` | `setVersion(org.apache.hc.core5.http.ProtocolVersion version)`
    `String` | `toString()`

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

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

- - ### Method Detail

    - #### getCode

          public int getCode()

      Specified by:
        `getCode` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### getEntity

          public org.apache.hc.core5.http.HttpEntity getEntity()

      Specified by:
        `getEntity` in interface `org.apache.hc.core5.http.HttpEntityContainer`

    - #### containsHeader

          public boolean containsHeader(String name)

      Specified by:
        `containsHeader` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### setVersion

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

      Specified by:
        `setVersion` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### setCode

          public void setCode(int code)

      Specified by:
        `setCode` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### getReasonPhrase

          public String getReasonPhrase()

      Specified by:
        `getReasonPhrase` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### countHeaders

          public int countHeaders(String name)

      Specified by:
        `countHeaders` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### setEntity

          public void setEntity(org.apache.hc.core5.http.HttpEntity entity)

      Specified by:
        `setEntity` in interface `org.apache.hc.core5.http.HttpEntityContainer`

    - #### getVersion

          public org.apache.hc.core5.http.ProtocolVersion getVersion()

      Specified by:
        `getVersion` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### setReasonPhrase

          public void setReasonPhrase(String reason)

      Specified by:
        `setReasonPhrase` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### getHeaders

          public org.apache.hc.core5.http.Header[] getHeaders(String name)

      Specified by:
        `getHeaders` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### addHeader

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

      Specified by:
        `addHeader` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### getLocale

          public Locale getLocale()

      Specified by:
        `getLocale` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### addHeader

          public void addHeader(String name,
                       Object value)

      Specified by:
        `addHeader` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### setLocale

          public void setLocale(Locale loc)

      Specified by:
        `setLocale` in interface `org.apache.hc.core5.http.HttpResponse`

    - #### getHeader

          public org.apache.hc.core5.http.Header getHeader(String name)
                                                    throws org.apache.hc.core5.http.ProtocolException

      Specified by:
        `getHeader` in interface `org.apache.hc.core5.http.MessageHeaders`
      Throws:
        `org.apache.hc.core5.http.ProtocolException`

    - #### setHeader

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

      Specified by:
        `setHeader` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### getFirstHeader

          public org.apache.hc.core5.http.Header getFirstHeader(String name)

      Specified by:
        `getFirstHeader` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### setHeader

          public void setHeader(String name,
                       Object value)

      Specified by:
        `setHeader` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### setHeaders

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

      Specified by:
        `setHeaders` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### removeHeader

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

      Specified by:
        `removeHeader` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### removeHeaders

          public boolean removeHeaders(String name)

      Specified by:
        `removeHeaders` in interface `org.apache.hc.core5.http.HttpMessage`

    - #### getLastHeader

          public org.apache.hc.core5.http.Header getLastHeader(String name)

      Specified by:
        `getLastHeader` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### getHeaders

          public org.apache.hc.core5.http.Header[] getHeaders()

      Specified by:
        `getHeaders` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### headerIterator

          public Iterator<org.apache.hc.core5.http.Header> headerIterator()

      Specified by:
        `headerIterator` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### headerIterator

          public Iterator<org.apache.hc.core5.http.Header> headerIterator(String name)

      Specified by:
        `headerIterator` in interface `org.apache.hc.core5.http.MessageHeaders`

    - #### close

          public void close()
                     throws IOException

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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