public class HttpMessageConverterExtractor<T> extends java.lang.Object implements ResponseExtractor<T>
T
.RestTemplate
Constructor and Description |
---|
HttpMessageConverterExtractor(java.lang.Class<T> responseType,
java.util.List<HttpMessageConverter<?>> messageConverters)
Creates a new instance of the
HttpMessageConverterExtractor with the given
response type and message converters. |
HttpMessageConverterExtractor(java.lang.reflect.Type responseType,
java.util.List<HttpMessageConverter<?>> messageConverters)
Creates a new instance of the
HttpMessageConverterExtractor with the given
response type and message converters. |
Modifier and Type | Method and Description |
---|---|
T |
extractData(ClientHttpResponse response)
Extract data from the given
ClientHttpResponse and return it. |
protected boolean |
hasMessageBody(ClientHttpResponse response)
Indicates whether the given response has a message body.
|
public HttpMessageConverterExtractor(java.lang.Class<T> responseType, java.util.List<HttpMessageConverter<?>> messageConverters)
HttpMessageConverterExtractor
with the given
response type and message converters. The given converters must support the response
type.public HttpMessageConverterExtractor(java.lang.reflect.Type responseType, java.util.List<HttpMessageConverter<?>> messageConverters)
HttpMessageConverterExtractor
with the given
response type and message converters. The given converters must support the response
type.public T extractData(ClientHttpResponse response) throws java.io.IOException
ResponseExtractor
ClientHttpResponse
and return it.extractData
in interface ResponseExtractor<T>
response
- the HTTP responsejava.io.IOException
- in case of I/O errorsprotected boolean hasMessageBody(ClientHttpResponse response) throws java.io.IOException
Default implementation
returns false
for a response status of 204
or 304
, or a Content-Length
of 0
.
response
- the response to check for a message bodytrue
if the response has a body, false
otherwisejava.io.IOException
- in case of I/O errors