Class MultipartPayloadProvider

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<MultipartFormData>

    @Provider
    @Consumes("multipart/form-data")
    public class MultipartPayloadProvider
    extends Object
    implements javax.ws.rs.ext.MessageBodyReader<MultipartFormData>

    Provides a MessageBodyReader for MultipartFormData. This allows writing resources which consume MediaType.MULTIPART_FORM_DATA which is parsed into a MultipartFormData object:

     @POST
     @Consumes(MediaType.MULTIPART_FORM_DATA)
     void handleMultipartPost(MultipartFormData multipartFormData);
     

    The implementation used apache commons fileupload in order to parse the request and populate an instance of MultipartFormData.

    Author:
    Daniel Meyer
    • Constructor Detail

      • MultipartPayloadProvider

        public MultipartPayloadProvider()
    • Method Detail

      • isReadable

        public boolean isReadable​(Class<?> type,
                                  Type genericType,
                                  Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<MultipartFormData>
      • createFileUploadInstance

        protected org.apache.commons.fileupload.FileUpload createFileUploadInstance()
      • createMultipartFormDataInstance

        protected MultipartFormData createMultipartFormDataInstance()
      • parseRequest

        protected void parseRequest​(MultipartFormData multipartFormData,
                                    org.apache.commons.fileupload.FileUpload fileUpload,
                                    org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider.RestMultipartRequestContext requestContext)
      • createRequestContext

        protected org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider.RestMultipartRequestContext createRequestContext​(InputStream entityStream,
                                                                                                                               String contentType)