/**
* @param args
*/
public static void main(String[] args) throws Exception{
RestTemplate template = new RestTemplate();
Resource s2logo = new ClassPathResource(resourcePath);
MultiValueMap<String, Object> multipartMap = new LinkedMultiValueMap<String, Object>();
multipartMap.add("company", "SpringSource");
multipartMap.add("company-logo", s2logo);
logger.info("Created multipart request: " + multipartMap);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(new MediaType("multipart", "form-data"));
HttpEntity<Object> request = new HttpEntity<Object>(multipartMap, headers);
logger.info("Posting request to: " + uri);
ResponseEntity<?> httpResponse = template.exchange(uri, HttpMethod.POST, request, Object.class);
if (!httpResponse.getStatusCode().equals(HttpStatus.OK)){
logger.error("Problems with the request. Http status: " + httpResponse.getStatusCode());
}
}