clienthttprequest

WebResource multipart post request

五迷三道 提交于 2020-01-07 03:07:19
问题 I need to send post request using java test to this rest function : @RequestMapping(value = "/upload", method = RequestMethod.POST) public @ResponseBody String handleFileUpload(@PathVariable Long ownerId, @RequestBody MultipartFile file, HttpServletResponse response) throws IOException { //Some function } this is my trial: File file = new File("filePath"); FileDataBodyPart fileDataBodyPart = new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE); WebResource webResource =