随笔分类 -  HttpClient

摘要:private 构造函数private修饰构造函数在Singleton设计模式中经常使用。但是今天在读到EntityUtils时,发现这是一个final类。final很好理解:EntityUtils只是一个工具类,里面包含数个static方法来处理HttpEntity。所以,设置为final,提高运... 阅读全文
posted @ 2014-07-25 22:26 而远之 阅读(519) 评论(0) 推荐(0) 编辑
摘要:public static String httpGet(String url) { try { HttpGet httpGet = new HttpGet(url); HttpClient client = new DefaultHttpClient(); HttpResponse resp = client.execute(httpGet); HttpEntity entity = resp.getEntity(); String respCo... 阅读全文
posted @ 2014-04-04 23:24 而远之 阅读(17447) 评论(0) 推荐(1) 编辑