org.glassfish.jersey.message.internal
Class ReaderInterceptorExecutor

java.lang.Object
  extended by org.glassfish.jersey.message.internal.ReaderInterceptorExecutor
All Implemented Interfaces:
InterceptorContext, ReaderInterceptorContext

public class ReaderInterceptorExecutor
extends java.lang.Object
implements ReaderInterceptorContext

Entry point of the reader interceptor chain. It contstructs the chain of wrapped interceptor and invokes it. At the end of the chain MessageBodyWriter MBW is invoked which writes the entity to the output stream. The ExceptionWrapperInterceptor is always invoked on the client as a first interceptor.

Author:
Miroslav Fuksa (miroslav.fuksa at oracle.com)

Constructor Summary
ReaderInterceptorExecutor(GenericType genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType, MultivaluedMap<java.lang.String,java.lang.String> headers, java.util.Map<java.lang.String,java.lang.Object> properties, java.io.InputStream inputStream, MessageBodyWorkers workers, boolean intercept)
          Reads a type from the entityStream using interceptors.
 
Method Summary
 java.lang.annotation.Annotation[] getAnnotations()
           
 java.lang.reflect.Type getGenericType()
           
 MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
           
 java.io.InputStream getInputStream()
           
 MediaType getMediaType()
           
 ReaderInterceptor getNextInterceptor()
          Returns next interceptor in the chain.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
           
 java.lang.Class getType()
           
 java.lang.Object proceed()
          Starts the interceptor chain execution.
 void setAnnotations(java.lang.annotation.Annotation[] annotations)
           
 void setGenericType(java.lang.reflect.Type genericType)
           
 void setInputStream(java.io.InputStream is)
           
 void setMediaType(MediaType mediaType)
           
 void setType(java.lang.Class type)
           
 
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, getProperties, getType, setAnnotations, setGenericType, setMediaType, setType
 

Constructor Detail

ReaderInterceptorExecutor

public ReaderInterceptorExecutor(GenericType genericType,
                                 java.lang.annotation.Annotation[] annotations,
                                 MediaType mediaType,
                                 MultivaluedMap<java.lang.String,java.lang.String> headers,
                                 java.util.Map<java.lang.String,java.lang.Object> properties,
                                 java.io.InputStream inputStream,
                                 MessageBodyWorkers workers,
                                 boolean intercept)
Reads a type from the entityStream using interceptors.

Parameters:
genericType - the generic type that is to be read from the input stream.
annotations - an array of the 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 - the media type of the HTTP entity.
httpHeaders - the mutable HTTP headers associated with HTTP entity.
properties - the mutable map of request-scoped properties.
entityStream - the InputStream of the HTTP entity. The stream is not closed after reading the entity.
workers - Message body workers.
intercept - true if the user interceptors should be executed. Otherwise only exception wrapping interceptor will be executed in the client.
Throws:
WebApplicationException - Thrown when message body reader fails.
java.io.IOException - Thrown when reading from the entityStream fails.
Method Detail

getNextInterceptor

public ReaderInterceptor getNextInterceptor()
Returns next interceptor in the chain. Stateful method.

Returns:
Next interceptor.

proceed

public java.lang.Object proceed()
                         throws java.io.IOException
Starts the interceptor chain execution.

Specified by:
proceed in interface ReaderInterceptorContext
Returns:
an entity read from the stream.
Throws:
java.io.IOException

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in interface ReaderInterceptorContext

setInputStream

public void setInputStream(java.io.InputStream is)
Specified by:
setInputStream in interface ReaderInterceptorContext

getHeaders

public MultivaluedMap<java.lang.String,java.lang.String> getHeaders()
Specified by:
getHeaders in interface ReaderInterceptorContext

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Specified by:
getProperties in interface InterceptorContext

getAnnotations

public java.lang.annotation.Annotation[] getAnnotations()
Specified by:
getAnnotations in interface InterceptorContext

setAnnotations

public void setAnnotations(java.lang.annotation.Annotation[] annotations)
Specified by:
setAnnotations in interface InterceptorContext

getType

public java.lang.Class getType()
Specified by:
getType in interface InterceptorContext

setType

public void setType(java.lang.Class type)
Specified by:
setType in interface InterceptorContext

getGenericType

public java.lang.reflect.Type getGenericType()
Specified by:
getGenericType in interface InterceptorContext

setGenericType

public void setGenericType(java.lang.reflect.Type genericType)
Specified by:
setGenericType in interface InterceptorContext

getMediaType

public MediaType getMediaType()
Specified by:
getMediaType in interface InterceptorContext

setMediaType

public void setMediaType(MediaType mediaType)
Specified by:
setMediaType in interface InterceptorContext


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.