Interface ClientHttpResponse

All Superinterfaces:
AutoCloseable, Closeable, HttpInputMessage, HttpMessage
All Known Subinterfaces:
RestClient.RequestHeadersSpec.ConvertibleClientHttpResponse
All Known Implementing Classes:
AbstractClientHttpResponse, MockClientHttpResponse

public interface ClientHttpResponse extends HttpInputMessage, Closeable
Represents a client-side HTTP response.

Obtained via an invocation of ClientHttpRequest.execute().

A ClientHttpResponse must be closed, typically in a finally block.

Since:
3.0
Author:
Arjen Poutsma
  • Method Details

    • getStatusCode

      HttpStatusCode getStatusCode() throws IOException
      Get the HTTP status code as an HttpStatusCode.
      Returns:
      the HTTP status as HttpStatusCode value (never null)
      Throws:
      IOException - in case of I/O errors
    • getRawStatusCode

      @Deprecated(since="6.0", forRemoval=true) default int getRawStatusCode() throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 6.0, in favor of getStatusCode(); scheduled for removal in 6.2
      Get the HTTP status code as an integer.
      Returns:
      the HTTP status as an integer value
      Throws:
      IOException - in case of I/O errors
      Since:
      3.1.1
      See Also:
    • getStatusText

      String getStatusText() throws IOException
      Get the HTTP status text of the response.
      Returns:
      the HTTP status text
      Throws:
      IOException - in case of I/O errors
    • close

      void close()
      Close this response, freeing any resources created.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable