org.jboss.resteasy.core

## Class AbstractAsynchronousResponse

- java.lang.Object
- - org.jboss.resteasy.core.AbstractAsynchronousResponse

- All Implemented Interfaces:
    AsyncResponse, ResteasyAsynchronousResponse
  Direct Known Subclasses:
    SynchronousExecutionContext.SynchronousAsynchronousResponse

      public abstract class AbstractAsynchronousResponse
      extends Object
      implements ResteasyAsynchronousResponse

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Annotation[]` | `annotations`
    `protected List<CompletionCallback>` | `completionCallbacks`
    `protected SynchronousDispatcher` | `dispatcher`
    `protected ResourceMethodInvoker` | `method`
    `protected HttpRequest` | `request`
    `protected HttpResponse` | `response`
    `protected ContainerResponseFilter[]` | `responseFilters`
    `protected TimeoutHandler` | `timeoutHandler`
    `protected WriterInterceptor[]` | `writerInterceptors`

    - ### Fields inherited from interface javax.ws.rs.container.AsyncResponse

      `NO_TIMEOUT`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractAsynchronousResponse(SynchronousDispatcher dispatcher, HttpRequest request, HttpResponse response)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `completionCallbacks(Throwable throwable)`
    `Annotation[]` | `getAnnotations()`
    `ResourceMethodInvoker` | `getMethod()`
    `ContainerResponseFilter[]` | `getResponseFilters()`
    `WriterInterceptor[]` | `getWriterInterceptors()`
    `protected boolean` | `internalResume(Object entity)`
    `protected boolean` | `internalResume(Throwable exc)`
    `Collection<Class<?>>` | `register(Class<?> callback)` Register an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
    `Map<Class<?>,Collection<Class<?>>>` | `register(Class<?> callback, Class<?>... callbacks)` Register asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
    `Collection<Class<?>>` | `register(Object callback)` Register an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
    `Map<Class<?>,Collection<Class<?>>>` | `register(Object callback, Object... callbacks)` Register an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
    `void` | `setAnnotations(Annotation[] annotations)`
    `void` | `setMethod(ResourceMethodInvoker method)`
    `void` | `setResponseFilters(ContainerResponseFilter[] responseFilters)`
    `void` | `setTimeoutHandler(TimeoutHandler handler)` Set/replace a time-out handler for the suspended asynchronous response.
    `void` | `setWriterInterceptors(WriterInterceptor[] writerInterceptors)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.jboss.resteasy.spi.ResteasyAsynchronousResponse

      `initialRequestThreadFinished`

    - ### Methods inherited from interface javax.ws.rs.container.AsyncResponse

      `cancel, cancel, cancel, isCancelled, isDone, isSuspended, resume, resume, setTimeout`

- - ### Field Detail

    - #### dispatcher

          protected SynchronousDispatcher dispatcher

    - #### method

          protected ResourceMethodInvoker method

    - #### request

          protected HttpRequest request

    - #### response

          protected HttpResponse response

    - #### responseFilters

          protected ContainerResponseFilter[] responseFilters

    - #### writerInterceptors

          protected WriterInterceptor[] writerInterceptors

    - #### annotations

          protected Annotation[] annotations

    - #### timeoutHandler

          protected TimeoutHandler timeoutHandler

    - #### completionCallbacks

          protected List<CompletionCallback> completionCallbacks

  - ### Constructor Detail

    - #### AbstractAsynchronousResponse

          protected AbstractAsynchronousResponse(SynchronousDispatcher dispatcher,
                                      HttpRequest request,
                                      HttpResponse response)

  - ### Method Detail

    - #### register

          public Collection<Class<?>> register(Class<?> callback)
                                        throws NullPointerException

      Description copied from interface: `AsyncResponse`
      Register an asynchronous processing lifecycle callback class to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
      Specified by:
        `register` in interface `AsyncResponse`
      Parameters:
        `callback` - callback class.
      Returns:
        collection of registered callback interfaces. If the callback class does not implement any recognized callback interfaces, the returned collection will be empty.
      Throws:
        `NullPointerException` - in case the callback class is `null`.

    - #### register

          public Collection<Class<?>> register(Object callback)
                                        throws NullPointerException

      Description copied from interface: `AsyncResponse`
      Register an asynchronous processing lifecycle callback instance to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
      Specified by:
        `register` in interface `AsyncResponse`
      Parameters:
        `callback` - callback instance implementing one or more of the recognized callback interfaces.
      Returns:
        collection of registered callback interfaces. If the callback class does not implement any recognized callback interfaces, the returned collection will be empty.
      Throws:
        `NullPointerException` - in case the callback instance is `null`.

    - #### register

          public Map<Class<?>,Collection<Class<?>>> register(Class<?> callback,
                                                    Class<?>... callbacks)
                                                      throws NullPointerException

      Description copied from interface: `AsyncResponse`
      Register asynchronous processing lifecycle callback classes to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
      Specified by:
        `register` in interface `AsyncResponse`
      Parameters:
        `callback` - callback class.
        `callbacks` - additional callback classes.
      Returns:
        map of registered classes and the callback interfaces registered for each class. If a callback class does not implement any recognized callback interfaces, the associated collection of registered interfaces for the class will be empty.
      Throws:
        `NullPointerException` - in case any of the callback classes is `null`.

    - #### register

          public Map<Class<?>,Collection<Class<?>>> register(Object callback,
                                                    Object... callbacks)
                                                      throws NullPointerException

      Description copied from interface: `AsyncResponse`
      Register an asynchronous processing lifecycle callback instances to receive lifecycle events for the asynchronous response based on the implemented callback interfaces.
      Specified by:
        `register` in interface `AsyncResponse`
      Parameters:
        `callback` - callback instance.
        `callbacks` - additional callback instances.
      Returns:
        map of registered classes and the callback interfaces registered for each class. If a callback class does not implement any recognized callback interfaces, the associated collection of registered interfaces for the class will be empty.
      Throws:
        `NullPointerException` - in case any of the callback instances is `null`.

    - #### setTimeoutHandler

          public void setTimeoutHandler(TimeoutHandler handler)

      Description copied from interface: `AsyncResponse`
      Set/replace a time-out handler for the suspended asynchronous response.

      The time-out handler will be invoked when the suspend period of this asynchronous response times out. The job of the time-out handler is to resolve the time-out situation by either

      - resuming the suspended response
      - cancelling the suspended response
      - extending the suspend period by setting a new suspend time-out

      Note that in case the response is suspended `indefinitely`, the time-out handler may never be invoked.

      Specified by:
        `setTimeoutHandler` in interface `AsyncResponse`
      Parameters:
        `handler` - response time-out handler.

    - #### getMethod

          public ResourceMethodInvoker getMethod()

      Specified by:
        `getMethod` in interface `ResteasyAsynchronousResponse`

    - #### setMethod

          public void setMethod(ResourceMethodInvoker method)

      Specified by:
        `setMethod` in interface `ResteasyAsynchronousResponse`

    - #### getResponseFilters

          public ContainerResponseFilter[] getResponseFilters()

      Specified by:
        `getResponseFilters` in interface `ResteasyAsynchronousResponse`

    - #### setResponseFilters

          public void setResponseFilters(ContainerResponseFilter[] responseFilters)

      Specified by:
        `setResponseFilters` in interface `ResteasyAsynchronousResponse`

    - #### getWriterInterceptors

          public WriterInterceptor[] getWriterInterceptors()

      Specified by:
        `getWriterInterceptors` in interface `ResteasyAsynchronousResponse`

    - #### setWriterInterceptors

          public void setWriterInterceptors(WriterInterceptor[] writerInterceptors)

      Specified by:
        `setWriterInterceptors` in interface `ResteasyAsynchronousResponse`

    - #### getAnnotations

          public Annotation[] getAnnotations()

      Specified by:
        `getAnnotations` in interface `ResteasyAsynchronousResponse`

    - #### setAnnotations

          public void setAnnotations(Annotation[] annotations)

      Specified by:
        `setAnnotations` in interface `ResteasyAsynchronousResponse`

    - #### completionCallbacks

          protected void completionCallbacks(Throwable throwable)

    - #### internalResume

          protected boolean internalResume(Object entity)

    - #### internalResume

          protected boolean internalResume(Throwable exc)

Copyright © 2014. All Rights Reserved.