SPR-5866 - RestTemplate - access to Request Headers

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3087 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Arjen Poutsma
2010-03-11 17:41:30 +00:00
parent 4028e5aff8
commit 012d0983d0
2 changed files with 23 additions and 5 deletions
@@ -587,12 +587,21 @@ public class RestTemplate extends HttpAccessor implements RestOperations {
private final HttpMessageConverterExtractor<T> delegate;
public HttpEntityResponseExtractor(Class<T> responseType) {
this.delegate = new HttpMessageConverterExtractor<T>(responseType, getMessageConverters());
if (responseType != null) {
this.delegate = new HttpMessageConverterExtractor<T>(responseType, getMessageConverters());
} else {
this.delegate = null;
}
}
public HttpEntity<T> extractData(ClientHttpResponse response) throws IOException {
T body = delegate.extractData(response);
return new HttpEntity<T>(body, response.getHeaders());
if (delegate != null) {
T body = delegate.extractData(response);
return new HttpEntity<T>(body, response.getHeaders());
}
else {
return new HttpEntity<T>(response.getHeaders());
}
}
}