There no change in the rest call once restTemplate Object is returned back.
e.g. Here is POST methods that is used . RestUtil.getRestTemplate() just gets the restTemplate back
<code>
public JSONObject post(String url, JSONObject payload,
Map<String, String> uriMap) throws Exception {
logger.info("Executing rest call to url: " + url + ", with payload"
+ payload.toString());
RestTemplate restTemplate = RestUtil.getRestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.setAccept(Collections.singletonList(new MediaType(
"application", "json")));
HttpEntity<String> request = new HttpEntity<String>(payload.toJSONString(), headers);
ResponseEntity<String> responseEntity = null;
if (uriMap != null) {
responseEntity = restTemplate.postForEntity(url, request,
String.class, uriMap);
} else {
responseEntity = restTemplate.postForEntity(url, request,
String.class);
}
logger.debug("Response Status Code: " + responseEntity.getStatusCode());
String response = responseEntity.getBody();
JSONObject wfResponse = null;
try {
Object jsonResponse = new JSONParser().parse(response);
wfResponse = (JSONObject) jsonResponse;
logger.debug(wfResponse.toJSONString());
} catch (ParseException e) {
logger.error(ExceptionUtils.getFullStackTrace(e));
throw e;
}
logger.debug(wfResponse.toJSONString());
return wfResponse;
}
</code>