Interface RestClient.RequestHeadersspec.ConvertibleClientHttpResponse

All superinterfaces:
AutoCloseable, ClientHttpResponse, Closeable, HttpInputMessage, HttpMessage
Enclosing interface:
RestClient.RequestHeadersspec<s extends RestClient.RequestHeadersspec<s>>

public static interface RestClient.RequestHeadersspec.ConvertibleClientHttpResponse extends ClientHttpResponse
Extension of ClientHttpResponse that can convert the body.
since:
6.1
Author:
Arjen Poutsma, sebastien Deleuze
  • Method Details

    • bodyTo

      <T>&nbsp;@Nullable T&nbsp;bodyTo(Class<T>&nbsp;bodyType)
      Extract the response body as an object of the given type.
      Type Parameters:
      T - the body type
      Parameters:
      bodyType - the type of return value
      Returns:
      the body, or null if no response body was available
    • bodyTo

      <T>&nbsp;@Nullable T&nbsp;bodyTo(ParameterizedTypeReference<T>&nbsp;bodyType)
      Extract the response body as an object of the given type.
      Type Parameters:
      T - the body type
      Parameters:
      bodyType - the type of return value
      Returns:
      the body, or null if no response body was available
    • createException

      RestClientResponseException&nbsp;createException() throws IOException
      Create a RestClientResponseException of the appropriate subtype depending on the response status code. The exception contains the status, headers, and body of the response.
      Throws:
      IOException - in case of a response failure (e.g. to obtain the status)
      since:
      7.0