是否有处理缓存请求自己的HttpClient的? [英] Is there an HttpClient that handles caching requests on its own?

查看:343
本文介绍了是否有处理缓存请求自己的HttpClient的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,需要做出在网络上的内容反复提出要求。现在,在服务器端实现遵循的标准使用头文件HTTP缓存。我想知道是否有或扩展版本的HttpClient将存储的响应,并与头的自动缓存交互的另一种工具。如果没有一个是好的,我只是想跳过这个实施,如​​果有一个工具,已经在那里。

I have an app that needs to make repeated requests for content on the web. Now the server side implementation follows the standards for http caching using the headers. I was wondering if there is an extended version of HttpClient or another tool that will store responses and interact with the headers for automatic caching. If there isn't one that is fine, I would just like to skip implementing this if there is a tool already out there.

感谢

推荐答案

的Apache的HttpClient并引入<一href="http://hc.apache.org/httpcomponents-client-ga/httpclient-cache/apidocs/org/apache/http/impl/client/cache/CachingHttpClient.html">CachingHttpClient自4.1,但是Android仅包括4.0.x的默认情况下并不会维持的HttpClient的未来。从我的角度来看,我没有看到,$ P $手动pvent美国的进口,并用它与Android SDK的任何约束。

Apache HttpClient does introduce CachingHttpClient since 4.1, But Android only include 4.0.x by default and will not maintain HttpClient in the future. From my point of view, I don't see any constrains that prevent us manually import and use it with Android SDK.

推荐的方法是使用HttpURLConnection类,如在其官方博客这里

The recommended way is to use HttpURLConnection, as stated in their official blog here

编辑:

有一个很好的教程这里
下载页面这里
从它的官方网站的说明这里

A nice tutorial here
Download Page here
A note from its official website here:

结束生命
的   下议院的HttpClient项目现在结束生命,而不再被开发。它已取代在其HttpClient的和的HttpCore模块,提供更好的性能和更大的灵活性在Apache HttpComponents项目

End of life
The Commons HttpClient project is now end of life, and is no longer being developed. It has been replaced by the Apache HttpComponents project in its HttpClient and HttpCore modules, which offer better performance and more flexibility.

祝你好运,我有一个快速的尝试几个月前,但没有得到它相当成功(似乎只有在端口80上运行标准的Web服务器,而不是与我的自定义的工作)。

Good luck, I had a quick try several month ago, but didn't get it quite successful (it seems only work with standard web server running on port 80, not with my custom one).

这篇关于是否有处理缓存请求自己的HttpClient的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆