Java 上传到CXF restful web服务
我试图在我的cxf restful web服务中实现apache commons文件上传。由于某些原因,Java 上传到CXF restful web服务,java,web-services,file-upload,cxf,apache-commons,Java,Web Services,File Upload,Cxf,Apache Commons,我试图在我的cxf restful web服务中实现apache commons文件上传。由于某些原因,ServletFileUpload.isMultipartContent(…)总是返回false;我已经通过http://code>httpServletRequest.getContentType()检查了内容类型,它按预期返回多部分/表单数据。有人知道是什么导致isMultipartContent方法返回false吗?下面是我的代码: @POST @Path("/image
ServletFileUpload.isMultipartContent(…)
总是返回false;我已经通过http://code>httpServletRequest.getContentType()检查了内容类型,它按预期返回多部分/表单数据。有人知道是什么导致isMultipartContent方法返回false吗?下面是我的代码:
@POST
@Path("/images")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadImages(@Context javax.servlet.http.HttpServletRequest httpRequest) {
List items = null;
boolean isMultipart = ServletFileUpload.isMultipartContent(httpRequest);
if (isMultipart) {
...
...
} else { return Response.status(Status.BAD_REQUEST).build(); }
顺便说一句,为什么您使用
commons fileupload
而不是来自CXF的标准多部件机制?(见附件)