commons-httpclient 和 httpclient 之间的关系是什么,都来自 apache
这两个库之间的任何关系或差异。
Any relationship or difference between those two libraries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这两个库之间的任何关系或差异。
Any relationship or difference between those two libraries.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
Commons HttpClient 是一个产生 HttpClient 3.1 的旧项目。该项目被包含在更大的 Apache HttpComponents 项目中,该项目产生了 HttpClient 4.x。
这相当令人困惑,而且有点政治色彩,但旧的 Commons HttpClient 库现在已被弃用。
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.
是的。他们非常不同。首先,包名称不同,并且
4.x
API 比3.x
API 丰富得多。首先,
4.x
HttpClient API 基于旨在支持 HTTP 客户端和服务器端的核心库。核心旨在支持阻塞 I/O 和事件驱动 I/O,并且有一个 AsyncHttpClient API 顶部支持后者。该框架还有很多 cookie 管理、连接管理、客户端身份验证、代理路由、资源处理和流传输等功能。遗憾的是,这一切都意味着使用 HttpClient 3.x 构建的代码需要一个主要重写为使用 HttpClient 4.x。我想这就是@skaffman 提到的混乱和政治的根源。
但对我来说,最重要的是,如果您正在开发新项目,您应该使用 HttpClient 4.x。
Yes. They are very different. The package names are different for a start, and the
4.x
APIs are much richer than the3.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.