httpclientUtils
来源:互联网 发布:管家婆软件下载试用 编辑:程序博客网 时间:2024/05/22 01:34
package com.example.utils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class GetWroldUtils {
public static String GetWroldUtils1(String path) {
HttpClient client=new DefaultHttpClient();
HttpGet get=new HttpGet(path);
try {
HttpResponse execute = client.execute(get);
if(execute.getStatusLine().getStatusCode()==200){
return EntityUtils.toString(execute.getEntity());
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
public class GetWroldUtils {
public static String GetWroldUtils1(String path) {
HttpClient client=new DefaultHttpClient();
HttpGet get=new HttpGet(path);
try {
HttpResponse execute = client.execute(get);
if(execute.getStatusLine().getStatusCode()==200){
return EntityUtils.toString(execute.getEntity());
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
0 0
- httpclientUtils
- Web 开发工具类(2): HttpClientUtils
- NO.91 SSLPeerUnverifiedException 问题之解决(附HttpClientUtils升级版)
- 支持post,get请求(http,https)的HttpClientUtils
- Java之请求发送工具类(HttpClientUtils,爬虫)-yellowcong
- HttpClientUtils.post不设置超时时间容易导致,请求无法返回
- 面向对象的三大特征
- Android自带的下载功能,不需要断点续传、大文件下载、通知栏显示等窝心问题,四行代码全部搞定(经测)
- 服务器安全管理系统
- Grunt插件之uglify--js代码压缩与合并
- js如何循环拼接字符串
- httpclientUtils
- ubuntu 12.04 gcc版本为4.6降到4.4方法
- 通过XListView实现上拉加载下拉刷新
- kafka入门:简介、使用场景、设计原理、主要配置及集群搭建
- 在Qt5.4中如何实现QOpenGLWidget和QPainter混合编程
- Caffe+Kubuntu16.04_X64+CUDA 8.0配置
- XML解析之PULL解析
- 安卓谷歌电子市场学习笔记系列——ThreadPoolExecutor
- 解决 安卓SDK 下载packages失败问题