public abstract class AbstractWriterInterceptorContext extends Object implements WriterInterceptorContext
| Modifier and Type | Field and Description |
|---|---|
protected Annotation[] |
annotations |
protected Object |
entity |
protected Type |
genericType |
protected MultivaluedMap<String,Object> |
headers |
protected int |
index |
protected WriterInterceptor[] |
interceptors |
protected MediaType |
mediaType |
protected OutputStream |
outputStream |
protected ResteasyProviderFactory |
providerFactory |
protected Class |
type |
| Constructor and Description |
|---|
AbstractWriterInterceptorContext(WriterInterceptor[] interceptors,
Annotation[] annotations,
Object entity,
Type genericType,
MediaType mediaType,
Class type,
OutputStream outputStream,
ResteasyProviderFactory providerFactory,
MultivaluedMap<String,Object> headers) |
| Modifier and Type | Method and Description |
|---|---|
Annotation[] |
getAnnotations()
Get an array of the annotations formally declared on the artifact that
initiated the intercepted entity provider invocation.
|
Object |
getEntity()
Get object to be written as HTTP entity.
|
Type |
getGenericType()
Get the type of the object to be produced or written.
|
MultivaluedMap<String,Object> |
getHeaders()
Get mutable map of HTTP headers.
|
MediaType |
getMediaType()
Get media type of HTTP entity.
|
OutputStream |
getOutputStream()
Get the output stream for the object to be written.
|
Class |
getType()
Get Java type supported by corresponding message body provider.
|
protected MessageBodyWriter |
getWriter() |
void |
proceed()
Proceed to the next interceptor in the chain.
|
protected abstract MessageBodyWriter |
resolveWriter() |
void |
setAnnotations(Annotation[] annotations)
Update annotations on the formal declaration of the artifact that
initiated the intercepted entity provider invocation.
|
void |
setEntity(Object entity)
Update object to be written as HTTP entity.
|
void |
setGenericType(Type genericType)
Update type of the object to be produced or written.
|
void |
setMediaType(MediaType mediaType)
Update media type of HTTP entity.
|
void |
setOutputStream(OutputStream outputStream)
Update the output stream for the object to be written.
|
void |
setType(Class type)
Update Java type before calling message body provider.
|
protected void |
writeTo(MessageBodyWriter writer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetProperty, getPropertyNames, removeProperty, setPropertyprotected WriterInterceptor[] interceptors
protected Object entity
protected Class type
protected Type genericType
protected Annotation[] annotations
protected MediaType mediaType
protected MultivaluedMap<String,Object> headers
protected OutputStream outputStream
protected int index
protected ResteasyProviderFactory providerFactory
public AbstractWriterInterceptorContext(WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, MultivaluedMap<String,Object> headers)
public Object getEntity()
WriterInterceptorContextgetEntity in interface WriterInterceptorContextpublic void setEntity(Object entity)
WriterInterceptorContextsetEntity in interface WriterInterceptorContextentity - new object to be written.public Class getType()
InterceptorContextgetType in interface InterceptorContextpublic void setType(Class type)
InterceptorContextsetType in interface InterceptorContexttype - java type for providerpublic Type getGenericType()
InterceptorContextgetGenericType in interface InterceptorContextpublic void setGenericType(Type genericType)
InterceptorContextsetGenericType in interface InterceptorContextgenericType - new type for objectpublic Annotation[] getAnnotations()
InterceptorContextMethod.getParameterAnnotations();
if the server-side response entity instance is to be converted into an
output stream, this will be the annotations on the matched resource method
returned by Method.getAnnotations().
This method may return an empty array in case the interceptor is
not invoked in a context of any particular resource method
(e.g. as part of the client API), but will never return null.getAnnotations in interface InterceptorContextpublic void setAnnotations(Annotation[] annotations)
InterceptorContextsetAnnotations in interface InterceptorContextannotations - updated annotations declarataion of the artifact that
initiated the intercepted entity provider invocation.
Must not be null.public MediaType getMediaType()
InterceptorContextgetMediaType in interface InterceptorContextpublic void setMediaType(MediaType mediaType)
InterceptorContextsetMediaType in interface InterceptorContextmediaType - new type for HTTP entitypublic MultivaluedMap<String,Object> getHeaders()
WriterInterceptorContextgetHeaders in interface WriterInterceptorContextpublic OutputStream getOutputStream()
WriterInterceptorContextgetOutputStream in interface WriterInterceptorContextpublic void setOutputStream(OutputStream outputStream)
WriterInterceptorContextsetOutputStream in interface WriterInterceptorContextoutputStream - new output stream for the object to be written.public void proceed()
throws IOException,
WebApplicationException
WriterInterceptorContextMessageBodyWriter.writeTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, java.io.OutputStream) method.proceed in interface WriterInterceptorContextIOException - if an IO error arises or is thrown by the wrapped
MessageBodyWriter.writeTo method.WebApplicationException - thrown by the wrapped MessageBodyWriter.writeTo method.protected void writeTo(MessageBodyWriter writer) throws IOException
IOExceptionprotected MessageBodyWriter getWriter()
protected abstract MessageBodyWriter resolveWriter()
Copyright © 2018 JBoss by Red Hat. All rights reserved.