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.
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • headers

      private final javax.ws.rs.core.MultivaluedMap<String,String> headers
    • interceptors

      private final Iterator<javax.ws.rs.ext.ReaderInterceptor> interceptors
    • workers

      private final MessageBodyWorkers workers
    • translateNce

      private final boolean translateNce
    • injectionManager

      private final InjectionManager injectionManager
    • inputStream

      private InputStream 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 provided entityStream.
      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 by Method.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 - if true, the NoContentException thrown by a selected message body reader will be translated into a BadRequestException as required by
      injectionManager - injection manager.
  • Method Details

    • proceed

      public Object proceed() throws IOException
      Starts the interceptor chain execution.
      Specified by:
      proceed in interface javax.ws.rs.ext.ReaderInterceptorContext
      Returns:
      an entity read from the stream.
      Throws:
      IOException
    • getInputStream

      public InputStream getInputStream()
      Specified by:
      getInputStream in interface javax.ws.rs.ext.ReaderInterceptorContext
    • setInputStream

      public void setInputStream(InputStream is)
      Specified by:
      setInputStream in interface javax.ws.rs.ext.ReaderInterceptorContext
    • getHeaders

      public javax.ws.rs.core.MultivaluedMap<String,String> getHeaders()
      Specified by:
      getHeaders in interface javax.ws.rs.ext.ReaderInterceptorContext
    • 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 interface InjectionManagerSupplier
      Returns:
      injection manager.
    • closeableInputStream

      public static InputStream closeableInputStream(InputStream inputStream)
      Make the InputStream able to close.

      The purpose of this utility method is to undo effect of ReaderInterceptorExecutor.UnCloseableInputStream.

      Parameters:
      inputStream - Potential ReaderInterceptorExecutor.UnCloseableInputStream to undo its effect
      Returns:
      Input stream that is possible to close