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
  • Field Details

    • response

      private final org.apache.hc.core5.http.ClassicHttpResponse response
    • execRuntime

      private final ExecRuntime execRuntime
  • Constructor Details

    • CloseableHttpResponse

      CloseableHttpResponse(org.apache.hc.core5.http.ClassicHttpResponse response, ExecRuntime execRuntime)
  • Method Details

    • adapt

      static CloseableHttpResponse adapt(org.apache.hc.core5.http.ClassicHttpResponse response)
    • 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 AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object