Hi all
been at this for about a day, trying to get the resttemplate to post my multipart request.
heres the code that im using as a template.
My only differences are that i set headers for authentication and that I cant use the FileSystemResource to specifiy my file....Code:RestTemplate template = new RestTemplate(); String uri = "http://localhost:8080/multipart-http/inboundAdapter.htm"; Resource s2logo = new ClassPathResource("org/springframework/samples/multipart/spring09_logo.png"); MultiValueMap map = new LinkedMultiValueMap(); map.add("company", "SpringSource"); map.add("company-logo", s2logo); HttpHeaders headers = new HttpHeaders(); headers.setContentType(new MediaType("multipart", "form-data")); HttpEntity request = new HttpEntity(map, headers); ResponseEntity<?> httpResponse = template.exchange(uri, HttpMethod.POST, request, null);
everytime i execute the code i get
im using M2 and the file that i want to upload is not on my Classpath.Code:04-12 02:06:37.762: ERROR/BaseListActivity(6543): Could not write request: no suitable HttpMessageConverter found for request type [org.springframework.util.LinkedMultiValueMap] and content type [multipart/form-data]
.... id really appreciate the help
Many thanks as allways


Reply With Quote