RestTemplate请求

JSONObject json = new JSONObject(sendParam);
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
HttpEntity<String> reqE = new HttpEntity<String>(json.toString(), headers);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<Map> result = restTemplate.exchange(url, HttpMethod.POST, reqE, Map.class);

posted on 2017-03-06 17:30  腾逸  阅读(184)  评论(0编辑  收藏  举报