|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MessageBodyWorkers
An injectable interface providing lookup of MessageBodyReader and
MessageBodyWriter instances.
Context,
MessageBodyReader,
MessageBodyWriter| Nested Class Summary | |
|---|---|
static interface |
MessageBodyWorkers.MessageBodySizeCallback
Callback which will be used to pass back the size of the entity. |
| Method Summary | ||
|---|---|---|
|
getMessageBodyReader(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
Get a message body reader that matches a set of criteria. |
|
|
getMessageBodyReaderMediaTypes(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations)
Get the list of media types supported for a Java type. |
|
|
getMessageBodyWriter(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
Get a message body writer that matches a set of criteria. |
|
|
getMessageBodyWriterMediaType(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
java.util.List<MediaType> acceptableMediaTypes)
Get the most acceptable media type supported for a Java type given a set of acceptable media types. |
|
|
getMessageBodyWriterMediaTypes(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations)
Get the list of media types supported for a Java type. |
|
java.util.Set<ReaderInterceptor> |
getReaderInterceptors()
Returns global reader interceptors. |
|
java.util.Map<MediaType,java.util.List<MessageBodyReader>> |
getReaders(MediaType mediaType)
Get the map of media type to list of message body writers that are compatible with a media type. |
|
java.util.Set<WriterInterceptor> |
getWriterInterceptors()
Returns global writer interceptors. |
|
java.util.Map<MediaType,java.util.List<MessageBodyWriter>> |
getWriters(MediaType mediaType)
Get the map of media type to list of message body writers that are compatible with a media type. |
|
java.lang.String |
readersToString(java.util.Map<MediaType,java.util.List<MessageBodyReader>> readers)
Convert a map media type to list of message body readers to a string. |
|
|
readFrom(GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.InputStream entityStream,
boolean intercept)
Reads a type from the entityStream using interceptors. |
|
java.lang.String |
writersToString(java.util.Map<MediaType,java.util.List<MessageBodyWriter>> writers)
Convert a map media type to list of message body writers to a string. |
|
|
writeTo(java.lang.Object entity,
GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.OutputStream entityStream,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept)
Writers a type to the entityStream using interceptors. |
|
|
writeTo(java.lang.Object entity,
GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.OutputStream entityStream,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept,
boolean writeEntity)
Writers a type to the entityStream using interceptors. |
|
| Method Detail |
|---|
java.util.Map<MediaType,java.util.List<MessageBodyReader>> getReaders(MediaType mediaType)
mediaType - the compatible media type.
java.util.Map<MediaType,java.util.List<MessageBodyWriter>> getWriters(MediaType mediaType)
mediaType - the compatible media type.
java.lang.String readersToString(java.util.Map<MediaType,java.util.List<MessageBodyReader>> readers)
readers - the map media type to list of message body readers
java.lang.String writersToString(java.util.Map<MediaType,java.util.List<MessageBodyWriter>> writers)
writers - the map media type to list of message body readers
<T> MessageBodyReader<T> getMessageBodyReader(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
T - the type of object to be read.type - the class of object to be read.genericType - the type of object to be produced. E.g. if the message body is
to be converted into a method parameter, this will be the formal type of
the method parameter as returned by
Class.getGenericParameterTypes.annotations - an array of the annotations on the declaration of the artifact
that will be initialized with the produced instance. E.g. if the message
body is to be converted into a method parameter, this will be the
annotations on that parameter returned by
Class.getParameterAnnotations.mediaType - the media type of the data that will be read, this will be
compared to the values of Consumes for each
candidate reader and only matching readers will be queried.
<T> MessageBodyWriter<T> getMessageBodyWriter(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType)
T - the type of the object that is to be written.type - the class of object that is to be written.genericType - the type of object to be written. E.g. if the message body is to
be produced from a field, this will be the declared type of the field as
returned by Field.getGenericType.annotations - an array of the annotations on the declaration of the artifact
that will be written. E.g. if the message body is to be produced from a
field, this will be the annotations on that field returned by
Field.getDeclaredAnnotations.mediaType - the media type of the data that will be written, this will be
compared to the values of Produces for each
candidate writer and only matching writers will be queried.
<T> java.util.List<MediaType> getMessageBodyReaderMediaTypes(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations)
T - the type of object that is to be read.type - the class of object that is to be read.genericType - the type of object to be read. E.g. if the message body is to be
read as a method parameter, this will be the declared type of the
parameter as returned by Method.getGenericParameterTypes.annotations - an array of the annotations on the declaration of the artifact
that will be read. E.g. if the message body is to be consumed as a
method parameter, this will be the annotations on that parameter
returned by Method.getParameterAnnotations.
<T> java.util.List<MediaType> getMessageBodyWriterMediaTypes(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations)
T - the type of object that is to be written.type - the class of object that is to be written.genericType - the type of object to be written. E.g. if the message body is to
be produced from a field, this will be the declared type of the field as
returned by Field.getGenericType.annotations - an array of the annotations on the declaration of the artifact
that will be written. E.g. if the message body is to be produced from a
field, this will be the annotations on that field returned by
Field.getDeclaredAnnotations.
<T> MediaType getMessageBodyWriterMediaType(java.lang.Class<T> type,
java.lang.reflect.Type genericType,
java.lang.annotation.Annotation[] annotations,
java.util.List<MediaType> acceptableMediaTypes)
T - the type of object that is to be written.type - the class of object that is to be written.genericType - the type of object to be written. E.g. if the message body is to
be produced from a field, this will be the declared type of the field as
returned by Field.getGenericType.annotations - an array of the annotations on the declaration of the artifact
that will be written. E.g. if the message body is to be produced from a
field, this will be the annotations on that field returned by
Field.getDeclaredAnnotations.acceptableMediaTypes - the list of acceptable media types, sorted according to
the quality with the media type of highest quality occurring first
first.
java.util.Set<ReaderInterceptor> getReaderInterceptors()
java.util.Set<WriterInterceptor> getWriterInterceptors()
<T> java.lang.Object readFrom(GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.String> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.InputStream entityStream,
boolean intercept)
throws WebApplicationException,
java.io.IOException
entityStream using interceptors. If the
parameter intercept is true then reader
interceptors are excecuted before calling the message
body reader. The appropriate message body reader is
choosen after the interceptor execution based on parameter passed to this method
and modified by the interceptors.
genericType - the generic type that is to be read from the input stream.annotations - an array of the annotations on the declaration of the artifact
that will be initialized with the produced instance. E.g. if the message
body is to be converted into a method parameter, this will be the
annotations on that parameter returned by
Method.getParameterAnnotations.mediaType - the media type of the HTTP entity.httpHeaders - the mutable HTTP headers associated with HTTP entity.properties - the mutable map of request-scoped
properties.entityStream - the InputStream of the HTTP entity. The stream is not
closed after reading the entity.intercept - true if the user interceptors should be executed. Otherwise only
exception wrapping interceptor will
be executed in the client.
entityStream.
WebApplicationException - Thrown when message body
reader fails.
java.io.IOException - Thrown when reading from the entityStream fails.
<T> void writeTo(java.lang.Object entity,
GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.OutputStream entityStream,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept)
throws java.io.IOException,
WebApplicationException
entityStream using interceptors. If the
parameter intercept is true then writer
interceptors are excecuted before calling the message
body writer. The appropriate message body writer is
choosen after the interceptor execution based on parameter passed to this method
and modified by the interceptors.
entity - Entity to be written to the entityStreamgenericType - the generic type to be written into the entityStream.annotations - an array of the annotations on the resource method that returns
the object.mediaType - the media type of the HTTP entity.httpHeaders - the mutable HTTP headers associated with HTTP entity.properties - the mutable map of request-scoped
properties.entityStream - the OutputStream for the HTTP entity.sizeCallback - the MessageBodyWorkers.MessageBodySizeCallback which will be invoked to
pass the size of the written entity. The callback will be invoked before
the first byte is written to the entityStream.intercept - true if the user interceptors should be executed. Otherwise only
exception wrapping interceptor will
be executed in the client.
WebApplicationException - Thrown when message body
reader fails.
java.io.IOException - Thrown when reading from the entityStream fails.
<T> void writeTo(java.lang.Object entity,
GenericType<T> genericType,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> httpHeaders,
java.util.Map<java.lang.String,java.lang.Object> properties,
java.io.OutputStream entityStream,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept,
boolean writeEntity)
throws java.io.IOException,
WebApplicationException
entityStream using interceptors. If the
parameter intercept is true then writer
interceptors are excecuted before calling the message
body writer. The appropriate message body writer is
choosen after the interceptor execution based on parameter passed to this method
and modified by the interceptors.
entity - Entity to be written to the entityStreamgenericType - the generic type to be written into the entityStream.annotations - an array of the annotations on the resource method that returns
the object.mediaType - the media type of the HTTP entity.httpHeaders - the mutable HTTP headers associated with HTTP entity.properties - the mutable map of request-scoped
properties.entityStream - the OutputStream for the HTTP entity.sizeCallback - the MessageBodyWorkers.MessageBodySizeCallback which will be invoked to
pass the size of the written entity. The callback will be invoked before
the first byte is written to the entityStream.intercept - true if the user interceptors should be executed. Otherwise only
exception wrapping interceptor will
be executed in the client.writeEntity - true if the entity should be written. Otherwise only headers will
be written to underlying OutputStream.
WebApplicationException - Thrown when message body
reader fails.
java.io.IOException - Thrown when reading from the entityStream fails.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||