开发者

Upload to CXF restful web service

I'm trying to impleme开发者_JAVA百科nt apache commons fileupload in my cxf restful web service. For some reason, ServletFileUpload.isMultipartContent(...) always returns false; I've checked the content-type via: httpServletRequest.getContentType() and it returns multipart/form-data as expected. Anyone know what is causing the isMultipartContent method to return false? Below is my code:

    @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(); }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜