java commons-httpclient 和 httpclient 之间的关系是什么,都来自 apache

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5153434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 09:43:15  来源:igfitidea点击:

what the relationship between commons-httpclient and httpclient, both from apache

javahttpclientapache-commons

提问by user496949

Any relationship or difference between those two libraries.

这两个库之间的任何关系或差异。

回答by skaffman

Commons HttpClientis an old project that produced HttpClient 3.1. The project was subsumed by the larger Apache HttpComponentsproject, which produced HttpClient 4.x.

Commons HttpClient是一个旧项目,它产生了 HttpClient 3.1。该项目被包含在更大的Apache HttpComponents项目中,该项目产生了HttpClient 4.x

It's rather confusing and a bit political, but the old Commons HttpClient library is now deprecated.

这相当令人困惑并且有点性,但旧的 Commons HttpClient 库现在已被弃用。

回答by Stephen C

Any ... difference between those two libraries.

这两个库之间的任何...差异。

Yes. They are very different. The package names are different for a start, and the 4.xAPIs are much richer than the 3.xAPIs.

是的。它们非常不同。一开始包名不同,4.xAPI比3.xAPI丰富得多。

For a start the 4.xHttpClient 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.

首先,4.xHttpClient API 基于旨在支持 HTTP 客户端和服务器端的核心库。内核旨在支持阻塞 I/O 和事件驱动 I/O,并且有一个 AsyncHttpClient API 顶部支持后者。该框架在cookie管理、连接管理、客户端认证、代理路由、资源处理和流媒体等方面也有很多。

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.

遗憾的是,这一切都意味着为使用 HttpClient 3.x 而构建的代码需要进行重大重写才能使用 HttpClient 4.x。我想这是@skaffman 所暗示的混乱和的根源。

But for me, the bottom line is that if you are developing new project, you shouldbe using HttpClient 4.x.

但对我来说,最重要的是,如果你正在开发新项目,你应该使用 HttpClient 4.x。