Package org.springframework.web.client
Interface ResponseExtractor<T>
- Type Parameters:
T
- the data type
- All Known Implementing Classes:
HttpMessageConverterExtractor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ResponseExtractor<T>
Generic callback interface used byRestTemplate
's retrieval methods Implementations of this interface perform the actual work of extracting data from aClientHttpResponse
, but don't need to worry about exception handling or closing resources.Used internally by the
RestTemplate
, but also useful for application code. There is one available factory method, seeRestTemplate.responseEntityExtractor(Type)
.
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
extractData(ClientHttpResponse response)
Extract data from the givenClientHttpResponse
and return it.
Method Detail
extractData
@Nullable T extractData(ClientHttpResponse response) throws IOException
Extract data from the givenClientHttpResponse
and return it.- Parameters:
response
- the HTTP response- Returns:
- the extracted data
- Throws:
IOException
- in case of I/O errors