use of org.craftercms.commons.rest.RestServiceException in project profile by craftercms.
the class AbstractProfileRestClientBase method doPostForUpload.
protected <T> T doPostForUpload(String url, MultiValueMap<String, Object> request, Class<T> responseType, Object... uriVariables) throws ProfileException {
try {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(request, headers);
return restTemplate.exchange(url, HttpMethod.POST, requestEntity, responseType, uriVariables).getBody();
} catch (RestServiceException e) {
handleRestServiceException(e);
} catch (Exception e) {
handleException(e);
}
return null;
}
Aggregations