Package org.jboss.resteasy.core.interception.jaxrs

## Class AbstractWriterInterceptorContext

- java.lang.Object
- - org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext

- All Implemented Interfaces:
    `javax.ws.rs.ext.InterceptorContext`, `javax.ws.rs.ext.WriterInterceptorContext`, `AsyncWriterInterceptorContext`
  Direct Known Subclasses:
    `ClientWriterInterceptorContext`, `ServerWriterInterceptorContext`

      public abstract class AbstractWriterInterceptorContext
      extends Object
      implements javax.ws.rs.ext.WriterInterceptorContext, AsyncWriterInterceptorContext

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Annotation[]` | `annotations` |
    `protected Object` | `entity` |
    `protected Type` | `genericType` |
    `protected javax.ws.rs.core.MultivaluedMap<String,​Object>` | `headers` |
    `protected int` | `index` |
    `protected javax.ws.rs.ext.WriterInterceptor[]` | `interceptors` |
    `protected javax.ws.rs.core.MediaType` | `mediaType` |
    `protected OutputStream` | `outputStream` |
    `protected ResteasyProviderFactory` | `providerFactory` |
    `protected boolean` | `requireAsyncIO` |
    `protected RESTEasyTracingLogger` | `tracingLogger` |
    `protected Class` | `type` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractWriterInterceptorContext​(javax.ws.rs.ext.WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, javax.ws.rs.core.MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, javax.ws.rs.core.MultivaluedMap<String,​Object> headers)` | Deprecated.
    `AbstractWriterInterceptorContext​(javax.ws.rs.ext.WriterInterceptor[] interceptors, Annotation[] annotations, Object entity, Type genericType, javax.ws.rs.core.MediaType mediaType, Class type, OutputStream outputStream, ResteasyProviderFactory providerFactory, javax.ws.rs.core.MultivaluedMap<String,​Object> headers, RESTEasyTracingLogger logger)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `CompletionStage<Void>` | `asyncProceed()` | Proceed to the next interceptor in the chain.
    `Annotation[]` | `getAnnotations()` |
    `AsyncOutputStream` | `getAsyncOutputStream()` | Get the async output stream for the object to be written.
    `Object` | `getEntity()` | Get object to be written as HTTP entity.
    `Type` | `getGenericType()` |
    `javax.ws.rs.core.MultivaluedMap<String,​Object>` | `getHeaders()` | Get mutable map of HTTP headers.
    `javax.ws.rs.core.MediaType` | `getMediaType()` |
    `OutputStream` | `getOutputStream()` |
    `int` | `getProcessedInterceptorCount()` |
    `CompletionStage<Void>` | `getStarted()` |
    `Class` | `getType()` |
    `protected javax.ws.rs.ext.MessageBodyWriter` | `getWriter()` |
    `protected boolean` | `preferAsyncIo()` |
    `void` | `proceed()` |
    `protected abstract javax.ws.rs.ext.MessageBodyWriter` | `resolveWriter()` |
    `void` | `setAnnotations​(Annotation[] annotations)` |
    `void` | `setAsyncOutputStream​(AsyncOutputStream asyncOutputStream)` | Set a new async output stream for the object to be written.
    `void` | `setEntity​(Object entity)` | Update object to be written as HTTP entity.
    `void` | `setGenericType​(Type genericType)` |
    `void` | `setMediaType​(javax.ws.rs.core.MediaType mediaType)` |
    `void` | `setOutputStream​(OutputStream outputStream)` |
    `void` | `setType​(Class type)` |
    `CompletionStage<Void>` | `syncProceed()` |
    `protected void` | `traceAfter​(javax.ws.rs.ext.WriterInterceptor interceptor)` |
    `protected void` | `traceBefore​(javax.ws.rs.ext.WriterInterceptor interceptor)` |
    `protected CompletionStage<Void>` | `writeTo​(javax.ws.rs.ext.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, wait`

    - ### Methods inherited from interface javax.ws.rs.ext.InterceptorContext

      `getProperty, getPropertyNames, removeProperty, setProperty`

- - ### Field Detail

    - #### tracingLogger

          protected RESTEasyTracingLogger tracingLogger

    - #### interceptors

          protected javax.ws.rs.ext.WriterInterceptor[] interceptors

    - #### requireAsyncIO

          protected boolean requireAsyncIO

    - #### entity

          protected Object entity

    - #### type

          protected Class type

    - #### genericType

          protected Type genericType

    - #### annotations

          protected Annotation[] annotations

    - #### mediaType

          protected javax.ws.rs.core.MediaType mediaType

    - #### headers

          protected javax.ws.rs.core.MultivaluedMap<String,​Object> headers

    - #### outputStream

          protected OutputStream outputStream

    - #### index

          protected int index

    - #### providerFactory

          protected ResteasyProviderFactory providerFactory

  - ### Constructor Detail

    - #### AbstractWriterInterceptorContext

          @Deprecated
          public AbstractWriterInterceptorContext​(javax.ws.rs.ext.WriterInterceptor[] interceptors,
                                                  Annotation[] annotations,
                                                  Object entity,
                                                  Type genericType,
                                                  javax.ws.rs.core.MediaType mediaType,
                                                  Class type,
                                                  OutputStream outputStream,
                                                  ResteasyProviderFactory providerFactory,
                                                  javax.ws.rs.core.MultivaluedMap<String,​Object> headers)

      Deprecated.

    - #### AbstractWriterInterceptorContext

          public AbstractWriterInterceptorContext​(javax.ws.rs.ext.WriterInterceptor[] interceptors,
                                                  Annotation[] annotations,
                                                  Object entity,
                                                  Type genericType,
                                                  javax.ws.rs.core.MediaType mediaType,
                                                  Class type,
                                                  OutputStream outputStream,
                                                  ResteasyProviderFactory providerFactory,
                                                  javax.ws.rs.core.MultivaluedMap<String,​Object> headers,
                                                  RESTEasyTracingLogger logger)

  - ### Method Detail

    - #### getProcessedInterceptorCount

          public int getProcessedInterceptorCount()

    - #### getEntity

          public Object getEntity()

      Description copied from interface: `AsyncWriterInterceptorContext`
      Get object to be written as HTTP entity.
      Specified by:
        `getEntity` in interface `AsyncWriterInterceptorContext`
      Specified by:
        `getEntity` in interface `javax.ws.rs.ext.WriterInterceptorContext`
      Returns:
        object to be written as HTTP entity.

    - #### setEntity

          public void setEntity​(Object entity)

      Description copied from interface: `AsyncWriterInterceptorContext`
      Update object to be written as HTTP entity.
      Specified by:
        `setEntity` in interface `AsyncWriterInterceptorContext`
      Specified by:
        `setEntity` in interface `javax.ws.rs.ext.WriterInterceptorContext`
      Parameters:
        `entity` - new object to be written.

    - #### getType

          public Class getType()

      Specified by:
        `getType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### setType

          public void setType​(Class type)

      Specified by:
        `setType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### getGenericType

          public Type getGenericType()

      Specified by:
        `getGenericType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### setGenericType

          public void setGenericType​(Type genericType)

      Specified by:
        `setGenericType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### getAnnotations

          public Annotation[] getAnnotations()

      Specified by:
        `getAnnotations` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### setAnnotations

          public void setAnnotations​(Annotation[] annotations)

      Specified by:
        `setAnnotations` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### getMediaType

          public javax.ws.rs.core.MediaType getMediaType()

      Specified by:
        `getMediaType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### setMediaType

          public void setMediaType​(javax.ws.rs.core.MediaType mediaType)

      Specified by:
        `setMediaType` in interface `javax.ws.rs.ext.InterceptorContext`

    - #### getHeaders

          public javax.ws.rs.core.MultivaluedMap<String,​Object> getHeaders()

      Description copied from interface: `AsyncWriterInterceptorContext`
      Get mutable map of HTTP headers.
      Specified by:
        `getHeaders` in interface `AsyncWriterInterceptorContext`
      Specified by:
        `getHeaders` in interface `javax.ws.rs.ext.WriterInterceptorContext`
      Returns:
        map of HTTP headers.

    - #### getOutputStream

          public OutputStream getOutputStream()

      Specified by:
        `getOutputStream` in interface `javax.ws.rs.ext.WriterInterceptorContext`

    - #### setOutputStream

          public void setOutputStream​(OutputStream outputStream)

      Specified by:
        `setOutputStream` in interface `javax.ws.rs.ext.WriterInterceptorContext`

    - #### setAsyncOutputStream

          public void setAsyncOutputStream​(AsyncOutputStream asyncOutputStream)

      Description copied from interface: `AsyncWriterInterceptorContext`
      Set 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:
        `setAsyncOutputStream` in interface `AsyncWriterInterceptorContext`
      Parameters:
        `asyncOutputStream` - new async output stream for the object to be written.

    - #### getAsyncOutputStream

          public AsyncOutputStream getAsyncOutputStream()

      Description copied from interface: `AsyncWriterInterceptorContext`
      Get the async output stream for the object to be written. The runtime is responsible for closing the output stream.
      Specified by:
        `getAsyncOutputStream` in interface `AsyncWriterInterceptorContext`
      Returns:
        async output stream for the object to be written.

    - #### getStarted

          public CompletionStage<Void> getStarted()

    - #### preferAsyncIo

          protected boolean preferAsyncIo()

    - #### asyncProceed

          public CompletionStage<Void> asyncProceed()

      Description copied from interface: `AsyncWriterInterceptorContext`
      Proceed 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 wrapped `AsyncMessageBodyWriter.asyncWriteTo(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>, org.jboss.resteasy.spi.AsyncOutputStream)` method.
      Specified by:
        `asyncProceed` in interface `AsyncWriterInterceptorContext`
      Returns:
        a `CompletionStage` indicating completion.

    - #### proceed

          public void proceed()
                       throws IOException,
                              javax.ws.rs.WebApplicationException

      Specified by:
        `proceed` in interface `javax.ws.rs.ext.WriterInterceptorContext`
      Throws:
        `IOException`
        `javax.ws.rs.WebApplicationException`

    - #### syncProceed

          public CompletionStage<Void> syncProceed()
                                            throws IOException,
                                                   javax.ws.rs.WebApplicationException

      Throws:
        `IOException`
        `javax.ws.rs.WebApplicationException`

    - #### traceBefore

          protected final void traceBefore​(javax.ws.rs.ext.WriterInterceptor interceptor)

    - #### traceAfter

          protected final void traceAfter​(javax.ws.rs.ext.WriterInterceptor interceptor)

    - #### writeTo

          protected CompletionStage<Void> writeTo​(javax.ws.rs.ext.MessageBodyWriter writer)
                                           throws IOException

      Throws:
        `IOException`

    - #### writeTo

          protected CompletionStage<Void> writeTo​(AsyncMessageBodyWriter writer)

    - #### getWriter

          protected javax.ws.rs.ext.MessageBodyWriter getWriter()

    - #### resolveWriter

          protected abstract javax.ws.rs.ext.MessageBodyWriter resolveWriter()