HttpClient的get应用
来源:互联网 发布:mysql 数据库合并 编辑:程序博客网 时间:2024/04/29 18:20
public static String getHtml()
{
StringBuffer sb = new StringBuffer();
HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://localhost:8080/atur");
try {
HttpResponse response = client.execute(httpGet);
HttpEntity entry = response.getEntity();
if(entry != null)
{
InputStreamReader ir = new InputStreamReader(entry.getContent());
BufferedReader in = new BufferedReader(ir);
String str = null;
while((str = in.readLine()) != null)
{
sb.append(str.trim());
}
in.close();
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(sb.toString());
return sb.toString();
}
导入:commons-logging-1.1.jar,httpclient-4.0-beta2.jar和httpcore-4.1-alpha1.jar架包
- HttpClient的get应用
- httpCLIENT的GET
- HttpClient的get请求
- HttpClient的get方式
- HttpClient的Get请求
- HttpClient--HttpClient的Get请求方式
- HttpClient应用之GET和POST申请
- HttpClient应用案例post&get方法
- HttpClient 的Get和Post
- HttpClient的get和post
- httpclient+HTMLParser的应用
- HttpClient的简单应用
- apache的HttpClient应用
- HttpClient的基础应用
- HttpClient的应用1
- 关于HttpClient的应用
- httpclient的get方法的官方API
- java HttpClient 的get使用的Demo
- javascript学习总结
- Exception starting filter struts2 Unable to load configuration. - [unknown location]
- 接口(Interface)和实现(implementation)
- 关于Android的nodpi,xhdpi,hdpi,mdpi,ldpi
- make 时nothing approprite 问题的解决办法
- HttpClient的get应用
- SQL练习
- Http返回状态码含义大全
- inherited Create(AOwner) 和inherited区别
- Sencha Touch 2中如何在DataView中显示IndexBar
- Dropbox 入侵外泄事件遗留的疑点
- opencv计算时间短小程序
- ubuntu安装五笔输入法
- 经常遇到的"Android Adb错误"的处理方法