views:

21

answers:

0

I'm trying to implement 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(); }