use of edu.hawaii.its.api.controller.RestTemplateResponseErrorHandler in project uhgroupings by uhawaii-system-its-ti-iam.
the class HttpRequestServiceImpl method makeApiRequest.
/*
* Make an http request to the API with path variables.
*/
@SuppressWarnings("lgtm[java/xss]")
@Override
public ResponseEntity<String> makeApiRequest(String currentUser, String uri, HttpMethod method) {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set(CURRENT_USER, currentUser);
HttpEntity<String> httpEntity = new HttpEntity<>(httpHeaders);
RestTemplate restTemplate = new RestTemplateBuilder().errorHandler(new RestTemplateResponseErrorHandler()).build();
return restTemplate.exchange(uri, method, httpEntity, String.class);
}
use of edu.hawaii.its.api.controller.RestTemplateResponseErrorHandler in project uhgroupings by uhawaii-system-its-ti-iam.
the class HttpRequestServiceImpl method makeApiRequestWithBody.
/*
* Make an http request to the API with path variables and description in the body.
*/
@SuppressWarnings("lgtm[java/xss]")
@Override
public ResponseEntity<String> makeApiRequestWithBody(String currentUser, String uri, String data, HttpMethod method) {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set(CURRENT_USER, currentUser);
HttpEntity<String> httpEntity = new HttpEntity<>(data, httpHeaders);
RestTemplate restTemplate = new RestTemplateBuilder().errorHandler(new RestTemplateResponseErrorHandler()).build();
return restTemplate.exchange(uri, method, httpEntity, String.class);
}
Aggregations