我正在尝试在我的cxf restful web服务中实现apache commons fileupload。出于某种原因,ServletFileUpload.isMultipartContent(...)
始终返回false;我通过httpServletRequest.getContentType()
检查了内容类型,并按预期返回multipart / form-data。有谁知道是什么导致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(); }