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 Summary
Modifier and TypeMethodDescription<T> @Nullable TExtract the response body as an object of the given type.<T> @Nullable TbodyTo(ParameterizedTypeReference<T> bodyType) Extract the response body as an object of the given type.Create aRestClientResponseExceptionof the appropriate subtype depending on the response status code.Methods inherited from interface ClientHttpResponse
close, getStatusCode, getStatusTextMethods inherited from interface HttpInputMessage
getBodyMethods inherited from interface HttpMessage
getHeaders
-
Method Details
-
bodyTo
-
bodyTo
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
nullif no response body was available
-
createException
Create aRestClientResponseExceptionof 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
-