get请求
来源:互联网 发布:联动mpos 机报件软件 编辑:程序博客网 时间:2024/06/05 01:08
/** * GET方式请求网络 */private void httpGet(String name) {// HttpClient得到HttpClient对象HttpClient httpClient = new DefaultHttpClient();// 以get方式请求.并设置接口地址HttpGet httpGet = new HttpGet(path + "consName=" + name+ "&type=year&key=3ac9f31ff66b9746539472887b3799c3");try {// 连接网络请求数据,请求到的数据在httpResponse对象里HttpResponse httpResponse = httpClient.execute(httpGet);// 服务器返回的内容在HttpEntityHttpEntity entity = httpResponse.getEntity();// 把entity转成StringString string = EntityUtils.toString(entity);// System.out.println(string);Gson gson = new Gson();Bean bean = gson.fromJson(string, Bean.class);Message msg = Message.obtain();msg.obj = bean;handler.sendMessage(msg);} catch (ClientProtocolException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
0 0
- get请求
- Get请求
- get请求
- GET请求
- get请求
- GET请求
- get请求
- get请求
- GET请求 Post请求
- get请求 post请求
- Get请求 Post请求
- get请求和post请求
- get请求和post请求
- GET请求和POST请求
- IOS-post请求、get请求
- GET请求和POST请求
- GET请求和POST请求
- GET请求和POST请求
- Android最全的屏幕适配
- CSS选择器
- 从 React Router 谈谈路由的那些事
- Mac 中显示资源库(Library)文件夹目录的几种方法
- touchstart ,touchmove, touchend 页面随手指滑动
- get请求
- online-simulator-in-linux-practice-linux-commands
- 昨天学到的使用SSM框架时从mysql中查到数据并展示出来的的两个下拉框
- Ubuntu 安装 gcc/g++ 5.0
- React服务器端渲染
- 学习之路之错误笔记day06之盒子模型及session
- JavaScript学习笔记八:函数定义和调用
- iOS开发零基础教程之真机调试流程
- 第二篇 zigbee基本概念--网络设备类型和PANID