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, wait
getProperty, getPropertyNames, removeProperty, setProperty
protected 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()
WriterInterceptorContext
getEntity
in interface WriterInterceptorContext
public void setEntity(Object entity)
WriterInterceptorContext
setEntity
in interface WriterInterceptorContext
entity
- new object to be written.public Class getType()
InterceptorContext
getType
in interface InterceptorContext
public void setType(Class type)
InterceptorContext
setType
in interface InterceptorContext
type
- java type for providerpublic Type getGenericType()
InterceptorContext
getGenericType
in interface InterceptorContext
public void setGenericType(Type genericType)
InterceptorContext
setGenericType
in interface InterceptorContext
genericType
- new type for objectpublic Annotation[] getAnnotations()
InterceptorContext
Method.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 InterceptorContext
public void setAnnotations(Annotation[] annotations)
InterceptorContext
setAnnotations
in interface InterceptorContext
annotations
- updated annotations declarataion of the artifact that
initiated the intercepted entity provider invocation.
Must not be null
.public MediaType getMediaType()
InterceptorContext
getMediaType
in interface InterceptorContext
public void setMediaType(MediaType mediaType)
InterceptorContext
setMediaType
in interface InterceptorContext
mediaType
- new type for HTTP entitypublic MultivaluedMap<String,Object> getHeaders()
WriterInterceptorContext
getHeaders
in interface WriterInterceptorContext
public OutputStream getOutputStream()
WriterInterceptorContext
getOutputStream
in interface WriterInterceptorContext
public void setOutputStream(OutputStream outputStream)
WriterInterceptorContext
setOutputStream
in interface WriterInterceptorContext
outputStream
- new output stream for the object to be written.public void proceed() throws IOException, WebApplicationException
WriterInterceptorContext
MessageBodyWriter.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 WriterInterceptorContext
IOException
- 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
IOException
protected MessageBodyWriter getWriter()
protected abstract MessageBodyWriter resolveWriter()
Copyright © 2016 JBoss by Red Hat. All rights reserved.