I want to pass a hosted file over the rest template to another end point. I have to pass the hosted file URL as a String.
See the below code.
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap<String, Object> map = new LinkedMultiValueMap<>();
map.add(ATTACHMENT,new FileSystemResource(request.getAttachment()));
HttpEntity<MultiValueMap<String,Object>> outBoundRequest = new HttpEntity<>(map, headers);
return restTemplate.exchange(uri[0],HttpMethod.POST,outBoundRequest,Response.class);
Suppose I am passing "http://www.africau.edu/images/default/sample.pdf";
Why I am getting "Illegal char <:> at index 4: http:\www.africau.edu\images\default\sample.pdf"?
Can anyone help me out here.
Thanks, Dasun.