您的位置:首页 > 其它

使用RestTemplate post方式提交表单数据

2017-09-12 10:40 513 查看
HttpHeadersheaders=newHttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);

MultiValueMap<String,String>map=newLinkedMultiValueMap<String,String>();
map.add("email","first.last@example.com");

HttpEntity<MultiValueMap<String,String>>request=newHttpEntity<MultiValueMap<String,String>>(map,headers);

ResponseEntity<String>response=restTemplate.postForEntity(url,request,String.class);



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: