@Provider @Consumes(value="image/*") @Produces(value="image/*") public class IIOImageProvider extends AbstractEntityProvider<IIOImage>
| Constructor and Description |
|---|
IIOImageProvider() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isReadable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Ascertain if the MessageBodyReader can produce an instance of a
particular type.
|
boolean |
isWriteable(Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType)
Ascertain if the MessageBodyWriter supports a particular type.
|
IIOImage |
readFrom(Class<IIOImage> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,String> httpHeaders,
InputStream entityStream)
Read a type from the
InputStream. |
void |
writeTo(IIOImage t,
Class<?> type,
Type genericType,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,Object> httpHeaders,
OutputStream entityStream)
Write a type to an HTTP message.
|
getSizepublic boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
MessageBodyReadertype parameter gives the
class of the instance that should be produced, the genericType parameter
gives the java.lang.reflect.Type of the instance
that should be produced.
E.g. if the instance to be produced is List<String>, the type parameter
will be java.util.List and the genericType parameter will be
java.lang.reflect.ParameterizedType.type - genericType - annotations - mediaType - the media type of the HTTP entity, if one is not
specified in the request then application/octet-stream is
used.javax.ws.rs.ext.MessageBodyReader#isReadable(java.lang.Class,
java.lang.reflect.Type, java.lang.annotation.Annotation[])public IIOImage readFrom(Class<IIOImage> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,String> httpHeaders, InputStream entityStream) throws IOException
MessageBodyReaderInputStream.
In case the entity input stream is empty, the reader is expected to either return a
Java representation of a zero-length entity or throw a NoContentException
in case no zero-length entity representation is defined for the supported Java type.
A NoContentException, if thrown by a message body reader while reading a server
request entity, is automatically translated by JAX-RS server runtime into a BadRequestException
wrapping the original NoContentException and rethrown for a standard processing by
the registered exception mappers.
type - genericType - annotations - mediaType - httpHeaders - entityStream - IOExceptionWebApplicationExceptionMessageBodyReader.readFrom(java.lang.Class,
java.lang.reflect.Type, java.lang.annotation.Annotation[],
javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap,
java.io.InputStream)public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
MessageBodyWritertype - genericType - annotations - mediaType - the media type of the HTTP entity.javax.ws.rs.ext.MessageBodyWriter#isWriteable(java.lang.Class,
java.lang.reflect.Type, java.lang.annotation.Annotation[])public void writeTo(IIOImage t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> httpHeaders, OutputStream entityStream) throws IOException
MessageBodyWritert - type - genericType - annotations - mediaType - httpHeaders - entityStream - IOExceptionWebApplicationExceptionMessageBodyWriter.writeTo(java.lang.Object,
java.lang.Class, java.lang.reflect.Type,
java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType,
javax.ws.rs.core.MultivaluedMap, java.io.OutputStream)Copyright © 2013. All Rights Reserved.