- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为了发出http请求,JAVA中有一些API可供选择,例如Apache HttpClient和Okhttp。 Apache HttpClient 已经成熟并且被广泛使用,而 Okhttp 似乎越来越流行(我不确定)。
我想知道的是,哪个更好,或者 Apache HttpClient 是否具有 Okhttp 没有的某些功能,或者反之亦然?大多数情况下,我谈论的是服务器端,谈论在 Android 应用程序中使用也非常好。
我希望能列出一些要点,这样我就可以弄清楚Apache HttpClient和Okhttp之间的区别。
引用:
URLConnection 和 HttpClient 之间存在问题: URLConnection or HTTPClient : Which offers better functionality and more efficiency?
最佳答案
我建议使用okhttp。原因如下:https://github.com/square/okhttp/issues/3472
OkHttp has HTTP/2, a built-in response cache, web sockets, and a simpler API. It’s got better defaults and is easier to use efficiently. It’s got a better URL model, a better cookie model, a better headers model and a better call model. OkHttp makes canceling calls easy. OkHttp has carefully managed TLS defaults that are secure and widely compatible. Okhttp works with Retrofit, which is a brilliant API for REST. It also works with Okio, which is a great library for data streams. OkHttp is a small library with one small dependency (Okio) and is less code to learn. OkHttp is more widely deployed, with a billion Android 4.4+ devices using it internally.
关于java - Okhttp 或 HTTPClient : Which offers better functionality and more efficiency?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42392778/
我是一名优秀的程序员,十分优秀!