标签:nta add type static linked .class protocol data params
public static ResponseBean getByPostData(String url,Map<String,Object> params) throws ClientProtocolException,
URISyntaxException, IOException {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/x-www-form-urlencoded");
MultiValueMap<String, Object> requestEntity = new LinkedMultiValueMap<>();
for (String key:params.keySet()) {
requestEntity.add(key,params.get(key).toString());
}
HttpEntity<MultiValueMap<String, Object>> r = new HttpEntity<>(
requestEntity, headers);
ResponseBean rspMsg = restTemplate.postForObject(url,r , ResponseBean.class);
return rspMsg;
}
标签:nta add type static linked .class protocol data params
原文地址:https://www.cnblogs.com/albert-think/p/9848923.html