RestTemplate、HttpHeaders、HttpEntity


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>

上一篇:Ant Design中使用Upload上传组件如何自定义文件列表展示位置


下一篇:Netty NioEventLoop自定义任务处理