HTTP GET 请求
来源:互联网 发布:多序列比对算法 编辑:程序博客网 时间:2024/06/16 10:14
/**
* HTTP GET方式
*
* @param url
* @return
* @throws IOException
* @throws ClientProtocolException
*/
public static String sendHttpForGet(String url) throws ClientProtocolException, IOException {
HttpClient client = null;
try {
client = new DefaultHttpClient();
client.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, httpClientConnectionTimeout);
client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, httpClinetSoTimeout);
HttpGet get = new HttpGet(url);
HttpResponse httpResponse = client.execute(get);
String respData = EntityUtils.toString(httpResponse.getEntity());
return respData;
} finally {
client.getConnectionManager().shutdown();
}
}
* HTTP GET方式
*
* @param url
* @return
* @throws IOException
* @throws ClientProtocolException
*/
public static String sendHttpForGet(String url) throws ClientProtocolException, IOException {
HttpClient client = null;
try {
client = new DefaultHttpClient();
client.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, httpClientConnectionTimeout);
client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, httpClinetSoTimeout);
HttpGet get = new HttpGet(url);
HttpResponse httpResponse = client.execute(get);
String respData = EntityUtils.toString(httpResponse.getEntity());
return respData;
} finally {
client.getConnectionManager().shutdown();
}
}
阅读全文
0 0
- http post get 请求
- Unity3d Http Get请求
- HTTP GET/POST 请求
- http post get请求
- HTTP Get请求
- http请求 get post
- http get请求
- http post get请求
- http get请求
- http get 请求
- HTTP请求GET,POST
- Http请求 post get
- HTTP GET 请求
- http中get请求
- HTTP GET 请求
- SCALA HTTP get请求
- HTTP GET/POST请求区别
- HTTP GET/POST请求区别
- 摄影测量笔记
- Android Studio Terminal 不是内部或外部命令,也不是可运行程序或批处理文件
- 安卓NDK开发环境配置与生成so文件方法二
- Servlet执行过程及生命周期
- 微信小程序实战篇-个人中心
- HTTP GET 请求
- 10.IDA-基本操作
- 求100以内的素数,全部打印出来
- exit()函数与_exit()函数及return关键字的区别: exit()和_exit()函数都可以用于结束进程,不过_exit()调用之后会立即进入内核,而exit()函数会先执行一些清理
- Sublime Text快捷键
- hbase 通过mapreduce方式对hbase表的备份及恢复(export import)
- 欢迎使用CSDN-markdown编辑器
- 2017 Multi-University Training Contest
- poj 1984 Navigation Nightmare