org.glassfish.jersey.message.internal
Class WriterInterceptorExecutor
java.lang.Object
org.glassfish.jersey.message.internal.WriterInterceptorExecutor
- All Implemented Interfaces:
- InterceptorContext, WriterInterceptorContext
public class WriterInterceptorExecutor
- extends java.lang.Object
- implements WriterInterceptorContext
Entry point of the writer interceptor chain. It constructs the chain of wrapped
interceptor and invokes it. At the end of the chain the MessageBodyWriter
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 |
WriterInterceptorExecutor(java.lang.Object entity,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> headers,
PropertiesDelegate propertiesDelegate,
java.io.OutputStream entityStream,
MessageBodyWorkers workers,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept,
boolean writeEntity)
Reads a type from the entityStream using interceptors. |
| 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 |
WriterInterceptorExecutor
public WriterInterceptorExecutor(java.lang.Object entity,
java.lang.Class<?> rawType,
java.lang.reflect.Type type,
java.lang.annotation.Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<java.lang.String,java.lang.Object> headers,
PropertiesDelegate propertiesDelegate,
java.io.OutputStream entityStream,
MessageBodyWorkers workers,
MessageBodyWorkers.MessageBodySizeCallback sizeCallback,
boolean intercept,
boolean writeEntity)
- Reads a type from the
entityStream using interceptors.
- Parameters:
entity - entity object to be processed.rawType - raw Java entity type.type - generic Java entity type.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.headers - the mutable HTTP headers associated with HTTP entity.propertiesDelegate - a request-scoped properties depegate.entityStream - the InputStream of the HTTP entity. The stream is not
closed after reading the entity.workers - Message body workers.sizeCallback - MessageBodyWorkers.MessageBodySizeCallback instance. Can be null.intercept - true if the user interceptors should be executed. Otherwise only
exception wrapping interceptor will
be executed in the client.writeEntity - true if the entity should be written. Otherwise only headers will
be written to underlying OutputStream.
getNextInterceptor
public WriterInterceptor getNextInterceptor()
- Returns next
interceptor in the chain. Stateful method.
- Returns:
- Next interceptor.
proceed
public void proceed()
throws java.io.IOException
- Starts the interceptor chain execution.
- Specified by:
proceed in interface WriterInterceptorContext
- Throws:
java.io.IOException
getEntity
public java.lang.Object getEntity()
- Specified by:
getEntity in interface WriterInterceptorContext
setEntity
public void setEntity(java.lang.Object entity)
- Specified by:
setEntity in interface WriterInterceptorContext
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStream in interface WriterInterceptorContext
setOutputStream
public void setOutputStream(java.io.OutputStream os)
- Specified by:
setOutputStream in interface WriterInterceptorContext
getHeaders
public MultivaluedMap<java.lang.String,java.lang.Object> getHeaders()
- Specified by:
getHeaders in interface WriterInterceptorContext
getProperty
public java.lang.Object getProperty(java.lang.String name)
- Specified by:
getProperty in interface InterceptorContext
getPropertyNames
public java.util.Enumeration<java.lang.String> getPropertyNames()
- Specified by:
getPropertyNames in interface InterceptorContext
setProperty
public void setProperty(java.lang.String name,
java.lang.Object object)
- Specified by:
setProperty in interface InterceptorContext
removeProperty
public void removeProperty(java.lang.String name)
- Specified by:
removeProperty 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.