Java 使用apache wink客户端上载多部分/表单数据文件
获取JAX-RS实体提供程序当前不存在。尝试上载文件时出现异常。。我如何注册错过的供应商 使用ApacheWink客户端和媒体类型上传文件的最佳方法是多部分/表单数据Java 使用apache wink客户端上载多部分/表单数据文件,java,rest,registration,multipartform-data,apache-wink,Java,Rest,Registration,Multipartform Data,Apache Wink,获取JAX-RS实体提供程序当前不存在。尝试上载文件时出现异常。。我如何注册错过的供应商 使用ApacheWink客户端和媒体类型上传文件的最佳方法是多部分/表单数据 /* BufferedOutMultiPart requestEntity = new BufferedOutMultiPart(); requestEntity.setBoundary("Simple-boundary-weqiftugcs"); OutPart outPart = new OutPart
/* BufferedOutMultiPart requestEntity = new BufferedOutMultiPart();
requestEntity.setBoundary("Simple-boundary-weqiftugcs");
OutPart outPart = new OutPart();
outPart.setBody(file);
outPart.setContentType(MediaType.MULTIPART_FORM_DATA);
outPart.addHeader("Content-Transfer-Encoding", "binary");
outPart.addHeader("Content-Disposition", "form-data; name=\"uploadedFile\";");
requestEntity.addPart(outPart); */
MultipartEntity multiPartEntity = new MultipartEntity();
FileBody fileBody = new FileBody(file);
multiPartEntity.addPart("uploadFile", fileBody);
ClientConfig clientConfig = new ClientConfig();
RestClient restClient = new RestClient(clientConfig);
Resource restResource = restClient.resource(serviceURL);
restResource.accept("*/*");
restResource.contentType(MediaType.MULTIPART_FORM_DATA);
restResource.post(multiPartEntity);
线程“main”中出现异常
org.apache.wink.client.ClientRuntimeException:java.lang.RuntimeException:
java.lang.RuntimeException:
找不到类org.apache.http.entity.mime.MultipartEntity的javax.ws.rs.ext.MessageBodyWriter实现
类型和多部分/表单数据媒体类型。验证所有实体提供程序是否正确
注册的。添加自定义javax.ws.rs.ext.MessageBodyWriter提供程序以处理类型和
如果JAX-RS实体提供程序当前不存在,则为媒体类型
我对它不熟悉,也无法给出答案,但我想大声说,他们把它弄得太复杂了。我自己的更容易。