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
a
message body writer
execution interceptor is inserted,
which writes entity to the output stream provided by the chain.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Terminal writer interceptor which choose the appropriateMessageBodyWriter
and writes the entity to the output stream.private static class
MessageBodyWriter
s should not close the givenstream
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Object
private final InjectionManager
private final Iterator
<javax.ws.rs.ext.WriterInterceptor> private static final Logger
private OutputStream
private int
-
Constructor Summary
ConstructorsConstructorDescriptionWriterInterceptorExecutor
(Object entity, Class<?> rawType, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> headers, PropertiesDelegate propertiesDelegate, OutputStream entityStream, MessageBodyWorkers workers, Iterable<javax.ws.rs.ext.WriterInterceptor> writerInterceptors, InjectionManager injectionManager) Constructs a new executor to write given type to providedentityStream
. -
Method Summary
Modifier and TypeMethodDescriptionGet injection manager.private javax.ws.rs.ext.WriterInterceptor
Returns nextinterceptor
in the chain.(package private) int
Get number of processed interceptors.void
proceed()
Starts the interceptor chain execution.void
void
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.ws.rs.ext.InterceptorContext
getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType
-
Field Details
-
LOGGER
-
outputStream
-
headers
-
entity
-
iterator
-
processedCount
private int processedCount -
injectionManager
-
-
Constructor Details
-
WriterInterceptorExecutor
public WriterInterceptorExecutor(Object entity, Class<?> rawType, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, Object> headers, PropertiesDelegate propertiesDelegate, OutputStream entityStream, MessageBodyWorkers workers, 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 Details
-
getNextInterceptor
private javax.ws.rs.ext.WriterInterceptor getNextInterceptor()Returns nextinterceptor
in the chain. Stateful method.- Returns:
- Next interceptor.
-
proceed
Starts the interceptor chain execution.- Specified by:
proceed
in interfacejavax.ws.rs.ext.WriterInterceptorContext
- Throws:
IOException
-
getEntity
- Specified by:
getEntity
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
setEntity
- Specified by:
setEntity
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getOutputStream
- Specified by:
getOutputStream
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
setOutputStream
- Specified by:
setOutputStream
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getHeaders
- Specified by:
getHeaders
in interfacejavax.ws.rs.ext.WriterInterceptorContext
-
getProcessedCount
int getProcessedCount()Get number of processed interceptors.- Returns:
- number of processed interceptors.
-
getInjectionManager
Description copied from interface:InjectionManagerSupplier
Get injection manager.- Specified by:
getInjectionManager
in interfaceInjectionManagerSupplier
- Returns:
- injection manager.
-