Some REST web services return 204 No Content as the result for a GET in certain circumstances. With this status, the response has no entity body and thus no Content-Type header.
RestTemplate.getForEntity throws an exception when receiving such a response:
org.springframework.web.client.RestClientException: Cannot extract response: no Content-Type found
An improvement for RestTemplate.getForEntity would be to return a ResponseEntity instance with the statusCode property set as appropriate for 204 No Content, and null values for the body and contentType properties.
I considered trying to extend RestTemplate to make it behave in this manner. Unfortunately, the extensive use of private static classes in the implementation makes it difficult to override the behavior of getForEntity – can't just replace the ResponseEntityResponseExtractor implementation without also replacing other unrelated collaborators (e.g. AcceptHeaderRequestCallback). It's possible to do it, it would just require a lot more code duplication than really seems warranted.
If you don't wish to change the behavior of RestTemplate.getForEntity, perhaps you might consider relaxing the access modifiers on these collaborator classes so that a subclass could make use of them?