Any r开发者_运维百科elationship or difference between those two libraries.
Commons HttpClient is an old project that produced HttpClient 3.1. The project was subsumed by the larger Apache HttpComponents project, which produced HttpClient 4.x.
It's rather confusing and a bit political, but the old Commons HttpClient library is now deprecated.
Any ... difference between those two libraries.
Yes. They are very different. The package names are different for a start, and the 4.x
APIs are much richer than the 3.x
APIs.
For a start the 4.x
HttpClient APIs are based on core libraries that are designed to support both the client and server sides of HTTP. The core is designed to support both blocking I/O and event driven I/O, and there is an AsyncHttpClient API top support the latter. The framework also has a lot in the way of cookie management, connection management, client-side authentication, proxy routing, resource handling and streaming, etc.
Sadly, this all means that code that was built to use HttpClient 3.x would need a major rewrite to use HttpClient 4.x. I guess this is the source of the confusion and politics that @skaffman alludes to.
But for me, the bottom line is that if you are developing new project, you should be using HttpClient 4.x.
精彩评论