Android Http
来源:互联网 发布:wince导航软件下载 编辑:程序博客网 时间:2024/05/16 12:16
HttpGet httpGet = new HttpGet(url);
这是一个get对象,url是连接,包含查询字符串
HttpClient httpClient = new DefaultHttpClient();
这个对象的execute(HttpGet httpGet)方法用于发送请求,同时返回一个HttpResponse对象。
HttpResponse httpResponse = new HttpResponse()
这个类代表服务器端的响应。getEntity()方法返回一个HttpEntity对象。
HttpEntity httpEntity = new UrlEncodedFormEntity();
这个类代表服务器返回的具体内容,也可以代表请求时候的内容。getContent()方法将会返回一个InputStream对象。
code:
post:
这是一个get对象,url是连接,包含查询字符串
HttpClient httpClient = new DefaultHttpClient();
这个对象的execute(HttpGet httpGet)方法用于发送请求,同时返回一个HttpResponse对象。
HttpResponse httpResponse = new HttpResponse()
这个类代表服务器端的响应。getEntity()方法返回一个HttpEntity对象。
HttpEntity httpEntity = new UrlEncodedFormEntity();
这个类代表服务器返回的具体内容,也可以代表请求时候的内容。getContent()方法将会返回一个InputStream对象。
code:
httpResponse = httpClient.execute(httpGet);httpEntity = httpResponse.getEntity();inputStream = httpEntity.getContent();BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));while((line=reader.readLine())!=null){result =result+line;}
post:
HttpEntity entity = new UrlEncodedFormEntity(list);HttpPost httpPost = new HttpPost(baseUrl);httpPost.setEntity(entity);HttpClient httpClient = new DefaultHttpClient();httpClient.execute(httpPost)....
- Android Http
- android - http
- android http
- android-http
- Android http
- android http
- android Http
- Android http
- android http
- Android HTTP
- android http
- Android.Http
- Android Http
- android-async-http(http通信)
- [Android]浅析Http框架 - Android-Async-http
- android http post 参数
- android http post请求
- android http上传文件
- java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-base
- 上周学习内容大放送(周五)
- 简介Java 标准日志工具 Log4j 的使用
- 想要过一辈子的情侣一定要看,一定要做到哦,一篇日志写出了心声…
- 业务顾问学ABAP一年多的感受
- Android Http
- 流氓软件及反流氓软件的技术分析2
- [收藏]C/C++数组名与指针区别
- jdk1.4,jdk1.5和jdk1.6的区别
- Android3.1和3.2及google_api下载使用说明
- BSONObjBuilder.obj()与BSONObjBuilder.done()的区别
- OpenCV2.2.0配置 Visual Stdio 2010
- swing 模仿QQ登录界面
- 天龙八部 - 跑商如何计算是否满票