类 HttpMessageConverterExtractor<T>
- java.lang.Object
- org.springframework.web.client.HttpMessageConverterExtractor<T>
- 类型参数:
T- the data type
- 所有已实现的接口:
ResponseExtractor<T>
public class HttpMessageConverterExtractor<T> extends Object implements ResponseExtractor<T>
Response extractor that uses the given entity converters to convert the response into a typeT.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Sam Brannen
- 另请参阅:
RestTemplate
构造器概要
构造器 构造器 说明 HttpMessageConverterExtractor(Class<T> responseType, List<HttpMessageConverter<?>> messageConverters)Create a new instance of theHttpMessageConverterExtractorwith the given response type and message converters.HttpMessageConverterExtractor(Type responseType, List<HttpMessageConverter<?>> messageConverters)Creates a new instance of theHttpMessageConverterExtractorwith the given response type and message converters.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 TextractData(ClientHttpResponse response)Extract data from the givenClientHttpResponseand return it.protected MediaTypegetContentType(ClientHttpResponse response)Determine the Content-Type of the response based on the "Content-Type" header or otherwise default toMediaType.APPLICATION_OCTET_STREAM.
构造器详细资料
HttpMessageConverterExtractor
public HttpMessageConverterExtractor(Class<T> responseType, List<HttpMessageConverter<?>> messageConverters)
Create a new instance of theHttpMessageConverterExtractorwith the given response type and message converters. The given converters must support the response type.
HttpMessageConverterExtractor
public HttpMessageConverterExtractor(Type responseType, List<HttpMessageConverter<?>> messageConverters)
Creates a new instance of theHttpMessageConverterExtractorwith the given response type and message converters. The given converters must support the response type.
方法详细资料
extractData
public T extractData(ClientHttpResponse response) throws IOException
从接口复制的说明:ResponseExtractorExtract data from the givenClientHttpResponseand return it.- 指定者:
extractData在接口中ResponseExtractor<T>- 参数:
response- the HTTP response- 返回:
- the extracted data
- 抛出:
IOException- in case of I/O errors
getContentType
protected MediaType getContentType(ClientHttpResponse response)
Determine the Content-Type of the response based on the "Content-Type" header or otherwise default toMediaType.APPLICATION_OCTET_STREAM.- 参数:
response- the response- 返回:
- the MediaType, or "application/octet-stream"