Interface HttpResponse

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface HttpResponse
    extends java.lang.AutoCloseable
    After receiving and interpreting a request message, a server responds with an HTTP response message.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      HttpHeader[] getAllHeaders()
      Returns all the headers of this response.
      java.io.InputStream getContent()
      Obtains the content of this response, if any.
      HttpHeader getFirstHeader​(java.lang.String name)
      Returns the first header with a specified name of this response.
      HttpHeader[] getHeaders​(java.lang.String name)
      Returns all the headers with a specified name of this response.
      java.lang.String getHttpVersion()
      Returns the http version for this response.
      java.lang.String getReasonPhrase()
      Returns the reason phrase for this response.
      int getStatusCode()
      Returns the status code for this response.
      • Methods inherited from interface java.lang.AutoCloseable

        close
    • Method Detail

      • getHttpVersion

        java.lang.String getHttpVersion()
        Returns the http version for this response.
        Returns:
        the http version for this response.
      • getStatusCode

        int getStatusCode()
        Returns the status code for this response.
        Returns:
        the status code for this response.
      • getReasonPhrase

        java.lang.String getReasonPhrase()
        Returns the reason phrase for this response.
        Returns:
        the reason phrase for this response.
      • getAllHeaders

        HttpHeader[] getAllHeaders()
        Returns all the headers of this response.
        Returns:
        all the headers of this response.
      • getHeaders

        HttpHeader[] getHeaders​(java.lang.String name)
        Returns all the headers with a specified name of this response.
        Parameters:
        name - the name of the headers to return.
        Returns:
        the headers whose name property equals name.
      • getFirstHeader

        HttpHeader getFirstHeader​(java.lang.String name)
        Returns the first header with a specified name of this response.
        Parameters:
        name - the name of the header to return.
        Returns:
        the first header whose name property equals name or null if no such header could be found.
      • getContent

        java.io.InputStream getContent()
        Obtains the content of this response, if any.
        Returns:
        the content of this response, or null when there is no content.