apache http client vs urlconnection

Google has deprecated HttpClient

Choose an HTTP Client

Most network-connected Android apps use HTTP to send and
receive data. Android includes two HTTP clients:HttpURLConnection and
Apache HttpClient.
Both support HTTPS, streaming uploads and downloads, configurable
timeouts, IPv6, and connection pooling. We recommend
using HttpURLConnection for
applications targeted at Gingerbread and higher. For more discussion
of this topic, see the blog post Android‘s
HTTP Clients
.

Reference url:

http://codeblow.com/questions/apache-http-client-or-urlconnection/

http://www.oschina.net/question/871224_84258?sort=time

http://developer.android.com/training/basics/network-ops/connecting.html

http://blog.csdn.net/guolin_blog/article/details/12452307

时间: 2024-08-05 17:00:11

apache http client vs urlconnection的相关文章

apache.http.client.HttpClient

前言 HTTP 协议可能是现在 Internet 上使用得最多.最重要的协议了,越来越多的 Java 应用程序需要直接通过 HTTP 协议来访问网络资源.虽然在 JDK 的 java net包中已经提供了访问 HTTP 协议的基本功能,但是对于大部分应用程序来说,JDK 库本身提供的功能还不够丰富和灵活.HttpClient 是 Apache Jakarta Common 下的子项目,用来提供高效的.最新的.功能丰富的支持 HTTP 协议的客户端编程工具包,并且它支持 HTTP 协议最新的版本和

解决Apache虚拟主机报错问题apache AH01630: client denied by server configuration错误解决方法

今天同事咨询通过Apache搭建创建虚拟主机,搭建好发现一直报错,提示 "apache AH01630: client denied by server configuration",在网上搜索了一下, 发现这个错误的原因是,apache2.4 与 apache2.2 的虚拟主机配置写法不同导致. apache2.2的写法: [plain] view plain copy 在CODE上查看代码片派生到我的代码片 <VirtualHost *:80> ServerName f

org.apache.http.client.CircularRedirectException: Circular redirect to &quot;http://xxx&quot;问题解决

org.apache.http.client.CircularRedirectException: Circular redirect to "http://xxx"问题解决 用HttpClient的时候遇到一个问题:org.apache.http.client.CircularRedirectException: Circular redirect to...解决方法如下: HttpParams params = new BasicHttpParams();  HttpGet get

jetty client 与apache http client的实现、分析

谈到httpclient的话,只要会想到apache的httpclient和jetty的httpclient,但是apache的httpclient3和4之间又有区别,通过学些,最终总结了三种方式使用HttpClient, 分别为使用httpclient3,httpclient4,jetty的httpclient,下面分别来贴代码: 第1种:使用的jar包为commons-httpclient-3.1,只需要一个jar包即可 这里使用的是GetMethod,与httpcleint4有区别 pub

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Internal Server Error 错误

Solr报错: { "responseHeader": { "status": 500, "QTime": 11 }, "error": { "trace": "java.lang.RuntimeException\r\n\tat org.apache.solr.search.ExtendedDismaxQParser$ExtendedDismaxConfiguration.<init>

HttpURLConnection or Apache Http client

在安卓上网络请求有两种方式,一种是java自带的HttpURLConnection, 一种是Apache的Http Clinet, 但是要选择两方式比较好呢? 摘录Android 官方博客: Which client is best? Apache HTTP client has fewer bugs on Eclair and Froyo. It is the best choice for these releases. For Gingerbread and better, HttpURL

运行ava org.apache.axis.client.AdminClient时找不到org.apache.commons.logging.LogFactory

D:\Tomcat 5.0\webapps\axis\WEB-INF\classes>java org.apache.axis.client.AdminClie nt Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.commons.lo gging.LogFactory at org.apache.axis.components.logger.LogFactory.class$(LogFa

apache AH01630: client denied by server configuration错误解决方法

今天本来是想要在自己本地搭建一个wamp环境用来做一些代码的测试和框架的学习. 鉴于目前工作的时候用到了php5.5,所以就用了wamp-server V2.5版本,安装完成之后配置虚拟主机一直出现403,各种重启N次卸载重装,最后才好到问题的所在,故记录下来,希望其他同学有这样的问题的时候可以快速的解决~~ apache 虚拟主机配置: apache AH01630: client denied by server configuration错误解决方法 出现这个错误的原因是,apache2.

org.apache.http.client.HttpClient get/post请求

请求步骤 1.创建httpclient 对象 2.创建 请求方式,构造函数的值为请求路径 3.调用1中对象的execute() 方法,参数为 2 的对象 4.获取请求响应数据 5.释放连接资源 6.处理数据 一.使用org.apache.http.client.HttpClient 的get请求来实现 1.请求核心代码: // 创建 httpclient 对象       HttpClient httpclient = new DefaultHttpClient();    //创建请求方式,因