第一种方式

HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("Authorization", "Bearer " + getToken());
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
RestTemplate client = new RestTemplate(requestFactory);
HttpMethod method = HttpMethod.GET;
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(null, httpHeaders);
ResponseEntity<String> response = client.exchange(url, method, requestEntity, String.class);

第二种方式

event = event.toBuilder().requestTime(time).sign(sign).build();
String jsonString = JSON.toJSONString(event);
log.info("传输给关键小事的参数是[{}]", jsonString);
Request request = new Request.Builder()
.header("Content-Type", "application/json")
.header(PARAM_APP_KEY, APP_KEY)
.header(PARAM_SIGN, sign)
.header("Authorization", getToken())
.header(PARAM_REQUEST_TIME, time + "")
.post(RequestBody.create(null, jsonString))
.url(APPOINT_ATTENDANCE_URL)
.build();
JSONObject res = JSON.parseObject(HTTPClient.sendBodyString(request));

最新文章

  1. .NET跨平台之旅:将QPS 100左右的ASP.NET Core站点部署到Linux服务器上
  2. Codeforces Round #325 垫底纪念
  3. 【转】JavaSript模块规范 - AMD规范与CMD规范介绍
  4. 架构设计:负载均衡层设计方案(6)——Nginx + Keepalived构建高可用的负载层
  5. WordPress Lazy SEO插件lazyseo.php脚本任意文件上传漏洞
  6. C++编程规范之19:总是初始化变量
  7. 关于百度鹰眼中 xcode 7 编译报错问题
  8. android 边学边记 2015.10.16
  9. WPF自学笔记
  10. [其他]win7下chrome浏览器插件导出与导入
  11. PHPexcel(2)
  12. LeetCode 104. Maximum Depth of Binary Tree二叉树的最大深度 C++/Java
  13. HNOI2018游记
  14. GraphQL入门2
  15. chrome自定义ua(批处理文件方式)
  16. [转] Centos7 yum lock,无法上网问题,以及安装python3.5
  17. java 后台 post请求 携带参数 远程操作 调用接口
  18. qt.qpa.plugin: Could not find the Qt platform plugin &quot;windows&quot; in &quot;&quot;
  19. JDBC删除数据库实例
  20. ubuntu 14.04安装OVS虚拟OpenFlow交换机配置总结

热门文章

  1. 后端流传输excel文件到前端
  2. ArcGIS工具 - 导出空数据库
  3. Redux与前端表格施展“组合拳”,实现大屏展示应用的交互增强
  4. 03初识MapReduce
  5. string 类的用法
  6. 使用iframe引入文件后设置响应式宽高以及其他问题解决;
  7. C# 如何部分加载“超大”解决方案中的部分项目
  8. 非代码的贡献也能成为Committer,我与DolphinScheduler社区的故事
  9. C#支付宝用户的静默授权
  10. G - 逆序对的数量