Class WriterInterceptorExecutor
- java.lang.Object
-
- org.glassfish.jersey.message.internal.InterceptorExecutor<javax.ws.rs.ext.WriterInterceptor>
-
- org.glassfish.jersey.message.internal.WriterInterceptorExecutor
-
- All Implemented Interfaces:
javax.ws.rs.ext.InterceptorContext
,javax.ws.rs.ext.WriterInterceptorContext
,InjectionManagerSupplier
,PropertiesDelegate
public final class WriterInterceptorExecutor extends InterceptorExecutor<javax.ws.rs.ext.WriterInterceptor> implements javax.ws.rs.ext.WriterInterceptorContext, InjectionManagerSupplier
Represents writer interceptor chain executor for both client and server side. It constructs wrapped interceptor chain and invokes it. At the end of the chain amessage body writer
execution interceptor is inserted, which writes entity to the output stream provided by the chain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
WriterInterceptorExecutor.TerminalWriterInterceptor
Terminal writer interceptor which choose the appropriateMessageBodyWriter
and writes the entity to the output stream.private static class
WriterInterceptorExecutor.UnCloseableOutputStream
MessageBodyWriter
s should not close the givenstream
.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
entity
private javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object>
headers
private InjectionManager
injectionManager
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
-
Constructor Summary
Constructors Constructor 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, InjectionManager injectionManager)
Constructs a new executor to write given type to providedentityStream
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getEntity()
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object>
getHeaders()
InjectionManager
getInjectionManager()
Get injection manager.private javax.ws.rs.ext.WriterInterceptor
getNextInterceptor()
Returns nextinterceptor
in the chain.java.io.OutputStream
getOutputStream()
(package private) int
getProcessedCount()
Get number of processed interceptors.void
proceed()
Starts the interceptor chain execution.void
setEntity(java.lang.Object entity)
void
setOutputStream(java.io.OutputStream os)
-
Methods inherited from class org.glassfish.jersey.message.internal.InterceptorExecutor
clearLastTracedInterceptor, getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getTracingLogger, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType, traceAfter, traceBefore
-
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
outputStream
private java.io.OutputStream outputStream
-
headers
private final javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> headers
-
entity
private java.lang.Object entity
-
iterator
private final java.util.Iterator<javax.ws.rs.ext.WriterInterceptor> iterator
-
processedCount
private int processedCount
-
injectionManager
private final InjectionManager injectionManager
-
-
Constructor Detail
-
WriterInterceptorExecutor
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, InjectionManager injectionManager)
Constructs a new executor to write given type to providedentityStream
.- Parameters:
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 byMethod.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.injectionManager
- injection manager.
-
-
Method Detail
-
getNextInterceptor
private javax.ws.rs.ext.WriterInterceptor getNextInterceptor()
Returns nextinterceptor
in the chain. Stateful method.- Returns:
- Next interceptor.
-
proceed
public void proceed() throws java.io.IOException
Starts the interceptor chain execution.- Specified by:
proceed
in interfacejavax.ws.rs.ext.WriterInterceptorContext
- Throws:
java.io.IOException
-
getEntity
public java.lang.Object getEntity()
- Specified by:
getEntity
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
setEntity
public void setEntity(java.lang.Object entity)
- Specified by:
setEntity
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStream
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
setOutputStream
public void setOutputStream(java.io.OutputStream os)
- Specified by:
setOutputStream
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getHeaders
public javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.Object> getHeaders()
- Specified by:
getHeaders
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getProcessedCount
int getProcessedCount()
Get number of processed interceptors.- Returns:
- number of processed interceptors.
-
getInjectionManager
public InjectionManager getInjectionManager()
Description copied from interface:InjectionManagerSupplier
Get injection manager.- Specified by:
getInjectionManager
in interfaceInjectionManagerSupplier
- Returns:
- injection manager.
-
-