Class MultipartPayloadProvider
java.lang.Object
org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider
- All Implemented Interfaces:
jakarta.ws.rs.ext.MessageBodyReader<MultipartFormData>
@Provider
@Consumes("multipart/form-data")
public class MultipartPayloadProvider
extends Object
implements jakarta.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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.commons.fileupload.FileUpload
protected MultipartFormData
protected org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider.RestMultipartRequestContext
createRequestContext
(InputStream entityStream, String contentType) boolean
isReadable
(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) protected void
parseRequest
(MultipartFormData multipartFormData, org.apache.commons.fileupload.FileUpload fileUpload, org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider.RestMultipartRequestContext requestContext) readFrom
(Class<MultipartFormData> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-
Field Details
-
TYPE_NAME
- See Also:
-
SUB_TYPE_NAME
- See Also:
-
-
Constructor Details
-
MultipartPayloadProvider
public MultipartPayloadProvider()
-
-
Method Details
-
isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType) - Specified by:
isReadable
in interfacejakarta.ws.rs.ext.MessageBodyReader<MultipartFormData>
-
readFrom
public MultipartFormData readFrom(Class<MultipartFormData> type, Type genericType, Annotation[] annotations, jakarta.ws.rs.core.MediaType mediaType, jakarta.ws.rs.core.MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, jakarta.ws.rs.WebApplicationException- Specified by:
readFrom
in interfacejakarta.ws.rs.ext.MessageBodyReader<MultipartFormData>
- Throws:
IOException
jakarta.ws.rs.WebApplicationException
-
createFileUploadInstance
protected org.apache.commons.fileupload.FileUpload createFileUploadInstance() -
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)
-