相关疑难解决方法(0)

改造和OkHttp gzip解码

我希望将REST服务作为gzip编码的JSON使用.它提供了Content-Encoding: gzip,但我的OkHttp不会将其编码为可读文本,因此JSON转换器会抛出异常.

---> HTTP GET https://rapla.dhbw-karlsruhe.de/rapla/events?resources=%5B%27rc85dbd6-7d98-4eb7-a7f6-b867213c73d8%27%5D&start=2015-09-01&end=2015-12-31
Accept-Encoding: gzip, deflate
Accept: application/json
Authorization: *not posted*
Content-Type: application/json;charset=utf-8
---> END HTTP (no body)
<--- HTTP 200 https://rapla.dhbw-karlsruhe.de/rapla/events?resources=%5B%27rc85dbd6-7d98-4eb7-a7f6-b867213c73d8%27%5D&start=2015-09-01&end=2015-12-31 (13ms)
Date: Tue, 24 Nov 2015 09:09:10 GMT
Server: Jetty(9.2.2.v20140723)
Expires: Tue, 01 Jan 1980 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache, must-revalidate
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Content-Disposition: attachment
Content-Length: 9684
Via: 1.1 rapla.dhbw-karlsruhe.de
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
OkHttp-Selected-Protocol: http/1.1
OkHttp-Sent-Millis: 1448356149978
OkHttp-Received-Millis: 1448356149991

????WK?{??J?`k?_??Z????E?p?>3m?WMa?????p?0??<??
... skipped rest of the body
E??>???S???n …
Run Code Online (Sandbox Code Playgroud)

java retrofit okhttp

24
推荐指数
1
解决办法
2万
查看次数

标签 统计

java ×1

okhttp ×1

retrofit ×1