Class PlainTextMultipartUploadReader
java.lang.Object
org.apache.hadoop.ozone.s3.endpoint.PlainTextMultipartUploadReader
- All Implemented Interfaces:
javax.ws.rs.ext.MessageBodyReader<CompleteMultipartUploadRequest>
@Provider
@Consumes("text/plain")
public class PlainTextMultipartUploadReader
extends Object
implements javax.ws.rs.ext.MessageBodyReader<CompleteMultipartUploadRequest>
Body reader to accept plain text MPU.
Aws s3 api sends a multipartupload request with the content type 'text/plain' in case of using 'aws s3 cp' (instead of aws s3api).
Our generic ObjectEndpoint.multipartUpload has a CompleteMultipartUploadRequest parameter, which is required only for the completion request.
But JaxRS tries to parse it from the body for the requests and in case of text/plain requests this parsing is failed. This simple BodyReader enables to parse an empty text/plain message and return with an empty completion request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) readFrom(Class<CompleteMultipartUploadRequest> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-
Constructor Details
-
PlainTextMultipartUploadReader
public PlainTextMultipartUploadReader()
-
-
Method Details
-
isReadable
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType) - Specified by:
isReadablein interfacejavax.ws.rs.ext.MessageBodyReader<CompleteMultipartUploadRequest>
-
readFrom
public CompleteMultipartUploadRequest readFrom(Class<CompleteMultipartUploadRequest> type, Type genericType, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, javax.ws.rs.WebApplicationException- Specified by:
readFromin interfacejavax.ws.rs.ext.MessageBodyReader<CompleteMultipartUploadRequest>- Throws:
IOExceptionjavax.ws.rs.WebApplicationException
-