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

Backward compatibility with HttpClient 4.x.

Since:
  4.3

### Method Summary

Methods
`void` `addHeader(org.apache.hc.core5.http.Header header)`
`void` `addHeader(String name, Object value)`
`void` `close()`
`boolean` `containsHeader(String name)`
`int` `containsHeaders(String name)`
`org.apache.hc.core5.http.Header[]` `getAllHeaders()`
`int` `getCode()`
`org.apache.hc.core5.http.HttpEntity` `getEntity()`
`org.apache.hc.core5.http.Header` `getFirstHeader(String name)`
`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.Header` `getSingleHeader(String name)`
`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)`
`void` `removeHeader(org.apache.hc.core5.http.Header header)`
`void` `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.ClassicHttpResponse`

#### 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`

#### containsHeaders

    public int containsHeaders(String name)

Specified by:
  `containsHeaders` 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.ClassicHttpResponse`

#### 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`

#### getSingleHeader

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

Specified by:
  `getSingleHeader` 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 void removeHeader(org.apache.hc.core5.http.Header header)

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

#### removeHeaders

    public void 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`

#### getAllHeaders

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

Specified by:
  `getAllHeaders` 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`