Java テストを使用してポスト リクエストをこの残りの関数に送信する必要があります。
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public @ResponseBody String handleFileUpload(@PathVariable Long ownerId, @RequestBody MultipartFile file,
HttpServletResponse response) throws IOException {
//Some function
}
これは私の試みです:
File file = new File("filePath");
FileDataBodyPart fileDataBodyPart = new FileDataBodyPart("file", file, MediaType.MULTIPART_FORM_DATA_TYPE);
WebResource webResource = createResourceClient("restPath", user);
ClientResponse response = webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, fileDataBodyPart);
そしてエラーは言う:
「現在のリクエストはマルチパートリクエストではありません」