I need to maintain a legacy software. How do we use org.jboss.resteasy.client.ClientRequest to upload a file org.springframework.web.multipart.MultipartFile?
In short I would like to achieve:
curl -X POST http://mydomain/upload?sender=mr_abc -F file=@${FILE} using ClientRequest.
The ${FILE} can be any file as a string path example: /Users/mr_abc/mytarfile.tar.
Here what I have:
request = new ClientRequest("http://mydomain/upload");
request.header("Content-Type","multipart/form-data");
request.queryParameter("sender", "mr_abc");
request.queryParameter("file", new File("/Users/mr_abc/mytarfile.tar"));
ClientResponse<String> response = request.post(String.class);
Which resulted in error
Required request part 'file' is not present