首页 > Web开发 > 详细

RestTemplate、HttpHeaders、HttpEntity<String>

时间:2021-02-02 11:16:07      阅读:37      评论:0      收藏:0      [点我收藏+]

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.web.client.RestTemplate;


public static String hanlelPost(String url, String body){
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> formEntity = new HttpEntity<>(body, headers);
String json = restTemplate.postForEntity(url, formEntity, String.class).getBody();
return json;
}

RestTemplate、HttpHeaders、HttpEntity<String>

原文:https://www.cnblogs.com/nfmc/p/14360642.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!