Interface HttpResponse

  • All Superinterfaces:
    HttpMessage
    All Known Subinterfaces:
    CloseableHttpResponse
    All Known Implementing Classes:
    BasicHttpResponse

    public interface HttpResponse
    extends HttpMessage
    After receiving and interpreting a request message, a server responds with an HTTP response message.
         Response      = Status-Line
                         *(( general-header
                          | response-header
                          | entity-header ) CRLF)
                         CRLF
                         [ message-body ]
     
    Since:
    4.0
    • Method Detail

      • getStatusLine

        StatusLine getStatusLine()
        Obtains the status line of this response. The status line can be set using one of the setStatusLine methods, or it can be initialized in a constructor.
        Returns:
        the status line, or null if not yet set
      • setStatusLine

        void setStatusLine​(StatusLine statusline)
        Sets the status line of this response.
        Parameters:
        statusline - the status line of this response
      • setStatusLine

        void setStatusLine​(ProtocolVersion ver,
                           int code)
        Sets the status line of this response. The reason phrase will be determined based on the current locale.
        Parameters:
        ver - the HTTP version
        code - the status code
      • setStatusLine

        void setStatusLine​(ProtocolVersion ver,
                           int code,
                           String reason)
        Sets the status line of this response with a reason phrase.
        Parameters:
        ver - the HTTP version
        code - the status code
        reason - the reason phrase, or null to omit
      • getEntity

        HttpEntity getEntity()
        Obtains the message entity of this response, if any. The entity is provided by calling setEntity.
        Returns:
        the response entity, or null if there is none
      • getLocale

        Locale getLocale()
        Obtains the locale of this response. The locale is used to determine the reason phrase for the status code. It can be changed using setLocale.
        Returns:
        the locale of this response, never null
      • setLocale

        void setLocale​(Locale loc)
        Changes the locale of this response.
        Parameters:
        loc - the new locale