14 Star 18 Fork 2

明天的农夫 / VolleyOkHttpGzip

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

VolleyOkHttpGzip

This library includes three open source library code :

volley(Mirror https://github.com/mcxiaoke/android-volley) ,

okhttp(Mirror : https://github.com/square/okhttp),

okio(Mirror : https://github.com/square/okio).

  1. modify volley source code for the cachekey of jsonRequest ,like this mark(@github.com/jarlen) in JsonRequest.java (origin:"Method + url" as cacheKey,now : "mehod + url + params" as cacheKey)

  2. add MapRequest

  3. OkHttpClient as the transport layer for Volley (@link https://gist.github.com/bryanstern/4e8f1cb5a8e14c202750)

    private RequestQueue requestQueue = Volley.newRequestQueueWithOkHttp(this);

  4. Add gzip response for volley response

    GzipJsonObjectRequest objectRequest = new GzipJsonObjectRequest(?,?,?,?);

  5. Modify newRequestQueue function for changing cache dir

    private RequestQueue requestQueue = Volley.newRequestQueue(this, "mnt/sdcard/");

  6. add request with gzip

这个库包括三个开源项目代码,Volley OkHttp,Gzip

主要修改了以下几点:

  1. 优化了JsonRequest请求缓存处理Key,原始使用Method + Url 的方式,不能标示唯一的网络请求数据缓存Key,现调整为Method + url + params as cachekey (个人理解这样)

  2. 添加了网络请求参数为Map的请求方式

  3. 引入OkHttpClient作为Volley的网络传输层,具体参考与:(https://gist.github.com/bryanstern/4e8f1cb5a8e14c202750)

    private RequestQueue requestQueue = Volley.newRequestQueueWithOkHttp(this);

  4. 添加了网络请求返回数据Gzip数据解压处理。

    GzipJsonObjectRequest objectRequest = new GzipJsonObjectRequest(?,?,?,?);

  5. 改变volley请求队列创建接口,可以自定义缓存路径

    private RequestQueue requestQueue = Volley.newRequestQueue(this, "mnt/sdcard/")

  6. 添加实现可以gzip数据压缩请求

小弟不才,仅仅在原有开源库基础上做了一些调整,欢迎大家检视代码并指正,有兴趣的同学可以一起优化。

空文件

简介

Volley + OkHttp + Gzip 展开 收起
Android
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Android
1
https://gitee.com/jarlen/VolleyOkHttpGzip.git
git@gitee.com:jarlen/VolleyOkHttpGzip.git
jarlen
VolleyOkHttpGzip
VolleyOkHttpGzip
master

搜索帮助