Class MultipartPayloadProvider
- java.lang.Object
-
- org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider
-
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<MultipartFormData>
@Provider @Consumes("multipart/form-data") public class MultipartPayloadProvider extends java.lang.Object implements javax.ws.rs.ext.MessageBodyReader<MultipartFormData>
Provides a
MessageBodyReader
forMultipartFormData
. This allows writing resources which consumeMediaType.MULTIPART_FORM_DATA
which is parsed into aMultipartFormData
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
Fields Modifier and Type Field Description static java.lang.String
SUB_TYPE_NAME
static java.lang.String
TYPE_NAME
-
Constructor Summary
Constructors Constructor Description MultipartPayloadProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.commons.fileupload.FileUpload
createFileUploadInstance()
protected MultipartFormData
createMultipartFormDataInstance()
protected org.camunda.bpm.engine.rest.mapper.MultipartPayloadProvider.RestMultipartRequestContext
createRequestContext(java.io.InputStream entityStream, java.lang.String contentType)
boolean
isReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.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)
MultipartFormData
readFrom(java.lang.Class<MultipartFormData> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream entityStream)
-
-
-
Field Detail
-
TYPE_NAME
public static final java.lang.String TYPE_NAME
- See Also:
- Constant Field Values
-
SUB_TYPE_NAME
public static final java.lang.String SUB_TYPE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
isReadable
public boolean isReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
- Specified by:
isReadable
in interfacejavax.ws.rs.ext.MessageBodyReader<MultipartFormData>
-
readFrom
public MultipartFormData readFrom(java.lang.Class<MultipartFormData> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> httpHeaders, java.io.InputStream entityStream) throws java.io.IOException, javax.ws.rs.WebApplicationException
- Specified by:
readFrom
in interfacejavax.ws.rs.ext.MessageBodyReader<MultipartFormData>
- Throws:
java.io.IOException
javax.ws.rs.WebApplicationException
-
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(java.io.InputStream entityStream, java.lang.String contentType)
-
-