InputStream is = entity.getContent();
if (is == null) {
return null;
}
Header header = httpResponse.getFirstHeader(Exchange.CONTENT_ENCODING);
String contentEncoding = header != null ? header.getValue() : null;
if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, Boolean.FALSE, Boolean.class)) {
is = GZIPHelper.uncompressGzip(contentEncoding, is);
}
// Honor the character encoding
String contentType = null;
header = httpRequest.getFirstHeader("content-type");
if (header != null) {
contentType = header.getValue();
// find the charset and set it to the Exchange
HttpHelper.setCharsetFromContentType(contentType, exchange);
}
InputStream response = doExtractResponseBodyAsStream(is, exchange);
// if content type is a serialized java object then de-serialize it back to a Java object