Class AbstractWriterInterceptorContext
java.lang.Object
org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext
- All Implemented Interfaces:
InterceptorContext,WriterInterceptorContext,AsyncWriterInterceptorContext
- Direct Known Subclasses:
ClientWriterInterceptorContext,ServerWriterInterceptorContext
public abstract class AbstractWriterInterceptorContext
extends Object
implements WriterInterceptorContext, AsyncWriterInterceptorContext
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Annotation[]protected Objectprotected Typeprotected MultivaluedMap<String,Object> protected intprotected WriterInterceptor[]protected MediaTypeprotected OutputStreamprotected ResteasyProviderFactoryprotected booleanprotected RESTEasyTracingLoggerprotected Class -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWriterInterceptorContext(WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, MultivaluedMap<String, Object> headers) Deprecated.AbstractWriterInterceptorContext(WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, MultivaluedMap<String, Object> headers, RESTEasyTracingLogger logger) -
Method Summary
Modifier and TypeMethodDescriptionProceed to the next interceptor in the chain.Get an array of the annotations formally declared on the artifact that initiated the intercepted entity provider invocation.Get the async output stream for the object to be written.Get object to be written as HTTP entity.Get the type of the object to be produced or written.Get mutable map of HTTP headers.Get media type of HTTP entity.Get the output stream for the object to be written.intgetType()Get Java type supported by corresponding message body provider.protected MessageBodyWriterprotected booleanvoidproceed()Proceed to the next interceptor in the chain.protected abstract MessageBodyWritervoidsetAnnotations(Annotation[] annotations) Update annotations on the formal declaration of the artifact that initiated the intercepted entity provider invocation.voidsetAsyncOutputStream(AsyncOutputStream asyncOutputStream) Set a new async output stream for the object to be written.voidUpdate object to be written as HTTP entity.voidsetGenericType(Type genericType) Update type of the object to be produced or written.voidsetMediaType(MediaType mediaType) Update media type of HTTP entity.voidsetOutputStream(OutputStream outputStream) Set a new output stream for the object to be written.voidUpdate Java type before calling message body provider.protected final voidtraceAfter(WriterInterceptor interceptor) protected final voidtraceBefore(WriterInterceptor interceptor) protected CompletionStage<Void>writeTo(MessageBodyWriter writer) protected CompletionStage<Void>writeTo(AsyncMessageBodyWriter writer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.ws.rs.ext.InterceptorContext
getProperty, getPropertyNames, hasProperty, removeProperty, setProperty
-
Field Details
-
tracingLogger
-
interceptors
-
requireAsyncIO
protected boolean requireAsyncIO -
entity
-
type
-
genericType
-
annotations
-
mediaType
-
headers
-
outputStream
-
index
protected int index -
providerFactory
-
-
Constructor Details
-
AbstractWriterInterceptorContext
@Deprecated public AbstractWriterInterceptorContext(WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, MultivaluedMap<String, Object> headers) Deprecated. -
AbstractWriterInterceptorContext
public AbstractWriterInterceptorContext(WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, MultivaluedMap<String, Object> headers, RESTEasyTracingLogger logger)
-
-
Method Details
-
getProcessedInterceptorCount
public int getProcessedInterceptorCount() -
getEntity
Description copied from interface:WriterInterceptorContextGet object to be written as HTTP entity.- Specified by:
getEntityin interfaceAsyncWriterInterceptorContext- Specified by:
getEntityin interfaceWriterInterceptorContext- Returns:
- object to be written as HTTP entity.
-
setEntity
Description copied from interface:WriterInterceptorContextUpdate object to be written as HTTP entity.- Specified by:
setEntityin interfaceAsyncWriterInterceptorContext- Specified by:
setEntityin interfaceWriterInterceptorContext- Parameters:
entity- new object to be written.
-
getType
Description copied from interface:InterceptorContextGet Java type supported by corresponding message body provider.- Specified by:
getTypein interfaceInterceptorContext- Returns:
- java type supported by provider
-
setType
Description copied from interface:InterceptorContextUpdate Java type before calling message body provider.- Specified by:
setTypein interfaceInterceptorContext- Parameters:
type- java type for provider
-
getGenericType
Description copied from interface:InterceptorContextGet the type of the object to be produced or written.- Specified by:
getGenericTypein interfaceInterceptorContext- Returns:
- type of object produced or written
-
setGenericType
Description copied from interface:InterceptorContextUpdate type of the object to be produced or written.- Specified by:
setGenericTypein interfaceInterceptorContext- Parameters:
genericType- new type for object
-
getAnnotations
Description copied from interface:InterceptorContextGet an array of the annotations formally declared on the artifact that initiated the intercepted entity provider invocation. E.g. if the message body is to be converted into a method parameter, this will be the annotations on that parameter returned byMethod.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 byMethod.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 returnnull.- Specified by:
getAnnotationsin interfaceInterceptorContext- Returns:
- annotations declared on the artifact that initiated the intercepted entity provider invocation.
-
setAnnotations
Description copied from interface:InterceptorContextUpdate annotations on the formal declaration of the artifact that initiated the intercepted entity provider invocation. Calling this method has no effect in the client API.- Specified by:
setAnnotationsin interfaceInterceptorContext- Parameters:
annotations- updated annotations declarataion of the artifact that initiated the intercepted entity provider invocation. Must not benull.
-
getMediaType
Description copied from interface:InterceptorContextGet media type of HTTP entity.- Specified by:
getMediaTypein interfaceInterceptorContext- Returns:
- media type of HTTP entity
-
setMediaType
Description copied from interface:InterceptorContextUpdate media type of HTTP entity.- Specified by:
setMediaTypein interfaceInterceptorContext- Parameters:
mediaType- new type for HTTP entity
-
getHeaders
Description copied from interface:WriterInterceptorContextGet mutable map of HTTP headers.- Specified by:
getHeadersin interfaceAsyncWriterInterceptorContext- Specified by:
getHeadersin interfaceWriterInterceptorContext- Returns:
- map of HTTP headers.
-
getOutputStream
Description copied from interface:WriterInterceptorContextGet the output stream for the object to be written. The JAX-RS runtime is responsible for closing the output stream.- Specified by:
getOutputStreamin interfaceWriterInterceptorContext- Returns:
- output stream for the object to be written.
-
setOutputStream
Description copied from interface:WriterInterceptorContextSet a new output stream for the object to be written. For example, by wrapping it with another output stream. The JAX-RS runtime is responsible for closing the output stream that is set.- Specified by:
setOutputStreamin interfaceWriterInterceptorContext- Parameters:
outputStream- new output stream for the object to be written.
-
setAsyncOutputStream
Description copied from interface:AsyncWriterInterceptorContextSet a new async output stream for the object to be written. For example, by wrapping it with another async output stream. The runtime is responsible for closing the async output stream that is set.- Specified by:
setAsyncOutputStreamin interfaceAsyncWriterInterceptorContext- Parameters:
asyncOutputStream- new async output stream for the object to be written.
-
getAsyncOutputStream
Description copied from interface:AsyncWriterInterceptorContextGet the async output stream for the object to be written. The runtime is responsible for closing the output stream.- Specified by:
getAsyncOutputStreamin interfaceAsyncWriterInterceptorContext- Returns:
- async output stream for the object to be written.
-
getStarted
-
preferAsyncIo
protected boolean preferAsyncIo() -
asyncProceed
Description copied from interface:AsyncWriterInterceptorContextProceed to the next interceptor in the chain. Interceptors MUST explicitly call this method to continue the execution chain; the call to this method in the last interceptor of the chain will invoke the wrappedAsyncMessageBodyWriter.asyncWriteTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], jakarta.ws.rs.core.MediaType, jakarta.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, org.jboss.resteasy.spi.AsyncOutputStream)method.- Specified by:
asyncProceedin interfaceAsyncWriterInterceptorContext- Returns:
- a
CompletionStageindicating completion.
-
proceed
Description copied from interface:WriterInterceptorContextProceed to the next interceptor in the chain. Interceptors MUST explicitly call this method to continue the execution chain; the call to this method in the last interceptor of the chain will invoke the wrappedMessageBodyWriter.writeTo(T, java.lang.Class<?>, java.lang.reflect.Type, java.lang.annotation.Annotation[], jakarta.ws.rs.core.MediaType, jakarta.ws.rs.core.MultivaluedMap<java.lang.String, java.lang.Object>, java.io.OutputStream)method.- Specified by:
proceedin interfaceWriterInterceptorContext- Throws:
IOException- if an IO error arises or is thrown by the wrappedMessageBodyWriter.writeTomethod.WebApplicationException- thrown by the wrappedMessageBodyWriter.writeTomethod.
-
syncProceed
- Throws:
IOExceptionWebApplicationException
-
traceBefore
-
traceAfter
-
writeTo
- Throws:
IOException
-
writeTo
-
getWriter
-
resolveWriter
-