Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

java - Is there an HttpClient that handles caching requests on its own?

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.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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

EDIT:

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

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.

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...