public final class WriterInterceptorExecutor extends InterceptorExecutor<javax.ws.rs.ext.WriterInterceptor> implements javax.ws.rs.ext.WriterInterceptorContext, ServiceLocatorSupplier
message body writer execution interceptor is inserted,
which writes entity to the output stream provided by the chain.| Modifier and Type | Class and Description |
|---|---|
private class |
WriterInterceptorExecutor.TerminalWriterInterceptor
Terminal writer interceptor which choose the appropriate
MessageBodyWriter
and writes the entity to the output stream. |
private static class |
WriterInterceptorExecutor.UnCloseableOutputStream
MessageBodyWriters should not close the given stream. |
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
entity |
private javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> |
headers |
private java.util.Iterator<javax.ws.rs.ext.WriterInterceptor> |
iterator |
private static java.util.logging.Logger |
LOGGER |
private java.io.OutputStream |
outputStream |
private int |
processedCount |
private org.glassfish.hk2.api.ServiceLocator |
serviceLocator |
| Constructor and Description |
|---|
WriterInterceptorExecutor(java.lang.Object entity,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> headers,
PropertiesDelegate propertiesDelegate,
java.io.OutputStream entityStream,
MessageBodyWorkers workers,
java.lang.Iterable<javax.ws.rs.ext.WriterInterceptor> writerInterceptors,
org.glassfish.hk2.api.ServiceLocator serviceLocator)
Constructs a new executor to write given type to provided
entityStream. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getEntity() |
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> |
getHeaders() |
javax.ws.rs.ext.WriterInterceptor |
getNextInterceptor()
Returns next
interceptor in the chain. |
java.io.OutputStream |
getOutputStream() |
(package private) int |
getProcessedCount()
Get number of processed interceptors.
|
org.glassfish.hk2.api.ServiceLocator |
getServiceLocator()
Get service locator.
|
void |
proceed()
Starts the interceptor chain execution.
|
void |
setEntity(java.lang.Object entity) |
void |
setOutputStream(java.io.OutputStream os) |
clearLastTracedInterceptor, getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getTracingLogger, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType, traceAfter, traceBeforeprivate static final java.util.logging.Logger LOGGER
private java.io.OutputStream outputStream
private final javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> headers
private java.lang.Object entity
private final java.util.Iterator<javax.ws.rs.ext.WriterInterceptor> iterator
private int processedCount
private final org.glassfish.hk2.api.ServiceLocator serviceLocator
public WriterInterceptorExecutor(java.lang.Object entity,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
javax.ws.rs.core.MediaType mediaType,
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> headers,
PropertiesDelegate propertiesDelegate,
java.io.OutputStream entityStream,
MessageBodyWorkers workers,
java.lang.Iterable<javax.ws.rs.ext.WriterInterceptor> writerInterceptors,
org.glassfish.hk2.api.ServiceLocator serviceLocator)
entityStream.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.writerInterceptors - Writer interceptors that are to be used to intercept writing of an entity.serviceLocator - Service locator.public javax.ws.rs.ext.WriterInterceptor getNextInterceptor()
interceptor in the chain. Stateful method.public void proceed()
throws java.io.IOException
proceed in interface javax.ws.rs.ext.WriterInterceptorContextjava.io.IOExceptionpublic java.lang.Object getEntity()
getEntity in interface javax.ws.rs.ext.WriterInterceptorContextpublic void setEntity(java.lang.Object entity)
setEntity in interface javax.ws.rs.ext.WriterInterceptorContextpublic java.io.OutputStream getOutputStream()
getOutputStream in interface javax.ws.rs.ext.WriterInterceptorContextpublic void setOutputStream(java.io.OutputStream os)
setOutputStream in interface javax.ws.rs.ext.WriterInterceptorContextpublic javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> getHeaders()
getHeaders in interface javax.ws.rs.ext.WriterInterceptorContextint getProcessedCount()
public org.glassfish.hk2.api.ServiceLocator getServiceLocator()
ServiceLocatorSuppliergetServiceLocator in interface ServiceLocatorSupplier