Fluent API(http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fluent.html)でhttpclient 4.5.3を使用しています。 4.2.xからhttpclient 4.5.3にアップグレードした後、応答の "Content-Encoding"ヘッダーが応答ヘッダーから削除されたように見え、gzip圧縮をサポートする方法がわかりません。GZIP with httpclient 4.5.3
私は「同意エンコード」を https://www.yahoo.comにGETリクエストをやってるし、ヘッダを送信しています:「GZIP」
4.5.3と私のレスポンスヘッダが今なしのContent-Encodingヘッダーに次のことを示しています
Date: Thu, 01 Jun 2017 21:21:55 GMT
Strict-Transport-Security: max-age=2592000
X-Frame-Options: DENY
Set-Cookie: autorf=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=www.yahoo.com
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
Age: 0
Transfer-Encoding: chunked
Connection: keep-alive
Via: http/1.1 ir11.fp.ne1.yahoo.com (ApacheTrafficServer)
Server: ATS
Cache-Control: no-store, no-cache, private, max-age=0
Expires: -1
私の応答ハンドラには、次のコードがあります。しかし、entity.getContentEncoding()は常にnullです。ヘッダー内のgzip:
デバッガを走るHttpEntity entity = response.getEntity();
Header header = entity.getContentEncoding();
if (header == null) {
return EntityUtils.toString(entity);
} else {
return handleGzipStream(entity);
}
、wrappedEntityは、Content-encodingを持っています表示されます。アクセスするにはどうしたらいいですか?または、httpclient 4.5.3でgzip圧縮を処理する適切な方法は何ですか?