org.apache.hc.core5.http

## Interface HttpResponse

- All Superinterfaces:
    HttpMessage, MessageHeaders
  All Known Subinterfaces:
    ClassicHttpResponse
  All Known Implementing Classes:
    BasicClassicHttpResponse, BasicHttpResponse, HttpResponseWrapper

      public interface HttpResponse
      extends HttpMessage

  After receiving and interpreting a request message, a server responds with an HTTP response message.
  Since:
    4.0

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getCode()` Obtains the code of this response message.
    `Locale` | `getLocale()` Obtains the locale of this response.
    `String` | `getReasonPhrase()` Obtains the reason phrase of this response if available.
    `void` | `setCode(int code)` Updates status code of this response message.
    `void` | `setLocale(Locale loc)` Changes the locale of this response.
    `void` | `setReasonPhrase(String reason)` Updates the status line of this response with a new reason phrase.

    - ### Methods inherited from interface org.apache.hc.core5.http.HttpMessage

      `addHeader, addHeader, getVersion, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setVersion`

    - ### Methods inherited from interface org.apache.hc.core5.http.MessageHeaders

      `containsHeader, countHeaders, getFirstHeader, getHeader, getHeaders, getHeaders, getLastHeader, headerIterator, headerIterator`

- - ### Method Detail

    - #### getCode

          int getCode()

      Obtains the code of this response message.
      Returns:
        the status code.

    - #### setCode

          void setCode(int code)

      Updates status code of this response message.
      Parameters:
        `code` - the HTTP status code.
      See Also:
        `HttpStatus`

    - #### getReasonPhrase

          String getReasonPhrase()

      Obtains the reason phrase of this response if available.
      Returns:
        the reason phrase.

    - #### setReasonPhrase

          void setReasonPhrase(String reason)

      Updates the status line of this response with a new reason phrase.
      Parameters:
        `reason` - the new reason phrase as a single-line string, or `null` to unset the reason phrase

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

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.