Class ReaderInterceptorExecutor
java.lang.Object
org.glassfish.jersey.message.internal.InterceptorExecutor<javax.ws.rs.ext.ReaderInterceptor>
org.glassfish.jersey.message.internal.ReaderInterceptorExecutor
- All Implemented Interfaces:
javax.ws.rs.ext.InterceptorContext
,javax.ws.rs.ext.ReaderInterceptorContext
,InjectionManagerSupplier
,PropertiesDelegate
public final class ReaderInterceptorExecutor
extends InterceptorExecutor<javax.ws.rs.ext.ReaderInterceptor>
implements javax.ws.rs.ext.ReaderInterceptorContext, InjectionManagerSupplier
Represents reader 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 reader
execution interceptor is inserted,
which finally reads an entity from the output stream provided by the chain.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Terminal reader interceptor which choose the appropriateMessageBodyReader
and reads the entity from the input stream.private static class
MessageBodyReader
s should not close the givenstream
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InjectionManager
private InputStream
private final Iterator<javax.ws.rs.ext.ReaderInterceptor>
private static final Logger
private int
private final boolean
private final MessageBodyWorkers
-
Constructor Summary
ConstructorsConstructorDescriptionReaderInterceptorExecutor
(Class<?> rawType, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, String> headers, PropertiesDelegate propertiesDelegate, InputStream inputStream, MessageBodyWorkers workers, Iterable<javax.ws.rs.ext.ReaderInterceptor> readerInterceptors, boolean translateNce, InjectionManager injectionManager) Constructs a new executor to read given type from providedentityStream
. -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
closeableInputStream
(InputStream inputStream) Make theInputStream
able to close.Get injection manager.(package private) int
Get number of processed interceptors.proceed()
Starts the interceptor chain execution.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
-
headers
-
interceptors
-
workers
-
translateNce
private final boolean translateNce -
injectionManager
-
inputStream
-
processedCount
private int processedCount
-
-
Constructor Details
-
ReaderInterceptorExecutor
ReaderInterceptorExecutor(Class<?> rawType, Type type, Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<String, String> headers, PropertiesDelegate propertiesDelegate, InputStream inputStream, MessageBodyWorkers workers, Iterable<javax.ws.rs.ext.ReaderInterceptor> readerInterceptors, boolean translateNce, InjectionManager injectionManager) Constructs a new executor to read given type from providedentityStream
.- Parameters:
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 message headers.propertiesDelegate
- request-scoped properties delegate.inputStream
- entity input stream.workers
-Message body workers
.readerInterceptors
- Reader interceptor that are to be used to intercept the reading of an entity. The interceptors will be executed in the same order as given in this parameter.translateNce
- iftrue
, theNoContentException
thrown by a selected message body reader will be translated into aBadRequestException
as required byinjectionManager
- injection manager.
-
-
Method Details
-
proceed
Starts the interceptor chain execution.- Specified by:
proceed
in interfacejavax.ws.rs.ext.ReaderInterceptorContext
- Returns:
- an entity read from the stream.
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStream
in interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
setInputStream
- Specified by:
setInputStream
in interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
getHeaders
- Specified by:
getHeaders
in interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
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.
-
closeableInputStream
Make theInputStream
able to close. The purpose of this utility method is to undo effect ofReaderInterceptorExecutor.UnCloseableInputStream
.- Parameters:
inputStream
- PotentialReaderInterceptorExecutor.UnCloseableInputStream
to undo its effect- Returns:
- Input stream that is possible to close
-