2条回答 默认 最新
- A智丨勇灬 2019-09-04 10:08关注
MultiValueMap<String, Object> requestBody = new LinkedMultiValueMap<>(); CloseableHttpClient httpClient = HttpClientBuilder.create().build(); HttpPost httpPost = new HttpPost(boostpayConfiguration.getUrl()); String jsonString = JSON.toJSONString(returnMap); StringEntity entity = new StringEntity(jsonString, "UTF-8"); httpPost.setEntity(entity); httpPost.setHeader("Content-Type", "application/json;charset=utf8"); httpPost.setHeader("Authorization", "Bearer " + boostPayVO.getApiToken()); CloseableHttpResponse response = null; // 由客户端执行(发送)Post请求 response = httpClient.execute(httpPost); // 从响应模型中获取响应实体 HttpEntity responseEntity = response.getEntity(); log.info("=====响应状态为:{}", response.getStatusLine()); if (responseEntity != null) { log.info("=====响应内容长度为:{}", responseEntity.getContentLength()); String responseJson = EntityUtils.toString(responseEntity); log.info("=====响应内容为:{}", responseJson); return JSON.parseObject(responseJson, Map.class); }
自己动手风衣足食
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥40 复杂的限制性的商函数处理
- ¥15 程序不包含适用于入口点的静态Main方法
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码