Class ContentResponseHandler

  • All Implemented Interfaces:
    org.apache.hc.core5.http.io.HttpClientResponseHandler<Content>

    public class ContentResponseHandler
    extends org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<Content>
    HttpClientResponseHandler implementation that converts HttpResponse messages to Content instances.
    Since:
    4.4
    See Also:
    Content
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Content handleEntity​(org.apache.hc.core5.http.HttpEntity entity)  
      Content handleResponse​(org.apache.hc.core5.http.ClassicHttpResponse response)
      Handles a successful response (2xx status code) and returns the response entity as a Content object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ContentResponseHandler

        public ContentResponseHandler()
    • Method Detail

      • handleEntity

        public Content handleEntity​(org.apache.hc.core5.http.HttpEntity entity)
                             throws java.io.IOException
        Specified by:
        handleEntity in class org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<Content>
        Throws:
        java.io.IOException
      • handleResponse

        public Content handleResponse​(org.apache.hc.core5.http.ClassicHttpResponse response)
                               throws java.io.IOException
        Handles a successful response (2xx status code) and returns the response entity as a Content object. If no response entity exists, Content.NO_CONTENT is returned.
        Specified by:
        handleResponse in interface org.apache.hc.core5.http.io.HttpClientResponseHandler<Content>
        Overrides:
        handleResponse in class org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<Content>
        Parameters:
        response - the HTTP response.
        Returns:
        a Content object that encapsulates the response body, or Content.NO_CONTENT if the response body is null or has zero length.
        Throws:
        org.apache.hc.client5.http.HttpResponseException - if the response was unsuccessful (status code greater than 300).
        java.io.IOException - if an I/O error occurs.