1、GET方式

HttpGet httpGet = new HttpGet("http://localhost:8080/randomCode/getSouthUuid");
String sourceId = "100001";
String appkey = "34";
List<NameValuePair> arrayList = new ArrayList<NameValuePair>();
arrayList.add(new BasicNameValuePair("clientId", sourceId));
arrayList.add(new BasicNameValuePair("appkey", appkey));
// 设置参数
String string = EntityUtils.toString(new UrlEncodedFormEntity(arrayList, "utf-8"));
httpGet.setURI(new URI(httpGet.getURI().toString() + "?" + string));
String str = httpInvoker.invoke(httpGet, HttpInvoker.STRING_ENTITY_HANDLER);

2、POST方式

HttpPost post = new HttpPost(url);
logger.debug("testpath --------->"+TESTPATH)
// 创建参数列表
List<NameValuePair> arrayList = new ArrayList<NameValuePair>();
arrayList.add(new BasicNameValuePair("code", "xxx"));
arrayList.add(new BasicNameValuePair("redirect_uri", "xxx"));
arrayList.add(new BasicNameValuePair("grant_type", "xxx"));
// url格式编码
UrlEncodedFormEntity uefEntity = new UrlEncodedFormEntity(arrayList, "UTF-8");
post.setEntity(uefEntity);
String str = httpInvoker.invoke(post, HttpInvoker.STRING_ENTITY_HANDLER);
JSONObject json = JSONObject.parseObject(str);
String values = json.get("xxx").toString();

最新文章

  1. UWP开发必备:常用数据列表控件汇总比较
  2. 鸟哥linux私房菜基础篇
  3. CSS盒模型
  4. JSP工作原理
  5. 状态模式 java &amp;&amp; php
  6. sp_executesql的执行计划会被重用(转载)
  7. Centos 6.5使用Bumblebee关闭N卡,冷却你的电脑
  8. 【安全组网】思科IOS设备基础应用
  9. Linux中与DNS相关的内容
  10. JMeter对Oracle数据库进行压力测试
  11. [TypeScript] Using Lodash in TypeScript with Typings and SystemJS
  12. BZOJ3564 信号增幅仪
  13. sublime设置sublimeREPL-python-run current file 快捷键
  14. Django 系列博客(八)
  15. python之线程(threading)
  16. 牛客网NOIP赛前集训营-提高组(第一场)B 数数字
  17. zabbix_windowsagent_cpu
  18. Excel中的基本概念
  19. Java调用.NET webservice方法的几种方式
  20. vue-cli环境搭建初探!

热门文章

  1. 邮箱图标的css样式
  2. C 输入和输出、char类型
  3. 微信小程序 自定义顶部状态栏
  4. Windows Socket知识总结
  5. Android中设置状态栏颜色和字体颜色
  6. Fundebug后端Node.js插件更新至0.2.0,支持监控Express慢请求
  7. Jmeter在chrome浏览器中录制脚本
  8. 201871010104-陈园园 《面向对象程序设计(java)》第七周学习总结
  9. day15_7.17正则表达式与re模块
  10. NOIP 2016 回文日期