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 classTerminal reader interceptor which choose the appropriateMessageBodyReaderand reads the entity from the input stream.private static classMessageBodyReaders should not close the givenstream. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final InjectionManagerprivate InputStreamprivate final Iterator<javax.ws.rs.ext.ReaderInterceptor> private static final Loggerprivate intprivate final booleanprivate 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 InputStreamcloseableInputStream(InputStream inputStream) Make theInputStreamable to close.Get injection manager.(package private) intGet number of processed interceptors.proceed()Starts the interceptor chain execution.voidMethods inherited from class org.glassfish.jersey.message.internal.InterceptorExecutor
clearLastTracedInterceptor, getAnnotations, getGenericType, getMediaType, getProperty, getPropertyNames, getTracingLogger, getType, removeProperty, setAnnotations, setGenericType, setMediaType, setProperty, setType, traceAfter, traceBeforeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, theNoContentExceptionthrown by a selected message body reader will be translated into aBadRequestExceptionas required byinjectionManager- injection manager.
-
-
Method Details
-
proceed
Starts the interceptor chain execution.- Specified by:
proceedin interfacejavax.ws.rs.ext.ReaderInterceptorContext- Returns:
- an entity read from the stream.
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStreamin interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
setInputStream
- Specified by:
setInputStreamin interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
getHeaders
- Specified by:
getHeadersin interfacejavax.ws.rs.ext.ReaderInterceptorContext
-
getProcessedCount
int getProcessedCount()Get number of processed interceptors.- Returns:
- number of processed interceptors.
-
getInjectionManager
Description copied from interface:InjectionManagerSupplierGet injection manager.- Specified by:
getInjectionManagerin interfaceInjectionManagerSupplier- Returns:
- injection manager.
-
closeableInputStream
Make theInputStreamable to close. The purpose of this utility method is to undo effect ofReaderInterceptorExecutor.UnCloseableInputStream.- Parameters:
inputStream- PotentialReaderInterceptorExecutor.UnCloseableInputStreamto undo its effect- Returns:
- Input stream that is possible to close
-