public final class WriterInterceptorExecutor extends Object implements WriterInterceptorContext
message body writer execution interceptor is inserted,
which writes entity to the output stream provided by the chain.| Modifier and Type | Field and Description |
|---|---|
static String |
INTERCEPTORS
Defines property, which is used to pass a list of writer interceptors
to the executor via
PropertiesDelegate. |
| Constructor and Description |
|---|
WriterInterceptorExecutor(Object entity,
Class<?> rawType,
Type type,
Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String,Object> headers,
PropertiesDelegate propertiesDelegate,
OutputStream entityStream,
MessageBodyWorkers workers,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept,
boolean writeEntity)
Constructs a new executor to write given type to provided
entityStream. |
| Modifier and Type | Method and Description |
|---|---|
Annotation[] |
getAnnotations() |
Object |
getEntity() |
Type |
getGenericType() |
MultivaluedMap<String,Object> |
getHeaders() |
MediaType |
getMediaType() |
WriterInterceptor |
getNextInterceptor()
Returns next
interceptor in the chain. |
OutputStream |
getOutputStream() |
Object |
getProperty(String name) |
Collection<String> |
getPropertyNames() |
Class |
getType() |
void |
proceed()
Starts the interceptor chain execution.
|
void |
removeProperty(String name) |
void |
setAnnotations(Annotation[] annotations) |
void |
setEntity(Object entity) |
void |
setGenericType(Type genericType) |
void |
setMediaType(MediaType mediaType) |
void |
setOutputStream(OutputStream os) |
void |
setProperty(String name,
Object object) |
void |
setType(Class type) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setTypepublic static final String INTERCEPTORS
PropertiesDelegate.public WriterInterceptorExecutor(Object entity, Class<?> rawType, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String,Object> headers, PropertiesDelegate propertiesDelegate, OutputStream entityStream, MessageBodyWorkers workers, MessageBodyWorkers.MessageBodySizeCallback sizeCallback, boolean intercept, boolean writeEntity)
entityStream.
List of interceptors to be used is taken from given workers instance
unless "jersey.runtime.writer.interceptors" property is set in propertiesDelegate.
If such a property is present, the executor tries to cast it to List<WriterInterceptor>
and the list is then used to build the interceptor chain.entity - entity object to be processed.rawType - raw Java entity type.type - generic Java entity type.annotations - array of 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 - media type of the HTTP entity.headers - mutable HTTP headers associated with HTTP entity.propertiesDelegate - request-scoped properties delegate.entityStream - InputStream from which an entity will be read. The stream is not
closed after reading the entity.workers - Message body workers.sizeCallback - MessageBodyWorkers.MessageBodySizeCallback instance. Can be null.intercept - if true, user interceptors will be executed. Otherwise only
exception wrapping interceptor will
be executed on the client side.writeEntity - if true, the entity will be written. Otherwise only headers will
be written to the underlying OutputStream.public WriterInterceptor getNextInterceptor()
interceptor in the chain. Stateful method.public void proceed()
throws IOException
proceed in interface WriterInterceptorContextIOExceptionpublic Object getEntity()
getEntity in interface WriterInterceptorContextpublic void setEntity(Object entity)
setEntity in interface WriterInterceptorContextpublic OutputStream getOutputStream()
getOutputStream in interface WriterInterceptorContextpublic void setOutputStream(OutputStream os)
setOutputStream in interface WriterInterceptorContextpublic MultivaluedMap<String,Object> getHeaders()
getHeaders in interface WriterInterceptorContextpublic Object getProperty(String name)
getProperty in interface InterceptorContextpublic Collection<String> getPropertyNames()
getPropertyNames in interface InterceptorContextpublic void setProperty(String name, Object object)
setProperty in interface InterceptorContextpublic void removeProperty(String name)
removeProperty in interface InterceptorContextpublic Annotation[] getAnnotations()
getAnnotations in interface InterceptorContextpublic void setAnnotations(Annotation[] annotations)
setAnnotations in interface InterceptorContextpublic Class getType()
getType in interface InterceptorContextpublic void setType(Class type)
setType in interface InterceptorContextpublic Type getGenericType()
getGenericType in interface InterceptorContextpublic void setGenericType(Type genericType)
setGenericType in interface InterceptorContextpublic MediaType getMediaType()
getMediaType in interface InterceptorContextpublic void setMediaType(MediaType mediaType)
setMediaType in interface InterceptorContextCopyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.