Package org.jboss.resteasy.core

## Class AsyncResponseConsumer

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

-     public abstract class AsyncResponseConsumer
      extends Object

  Version:
    $Revision: 1 $ The basic idea implemented by AsyncResponseConsumer is that a resource method returns a CompletionStage, an Observable, etc., and some version of AsyncResponseConsumer subscribes to it. Each subclass of AsyncResponseConsumer knows how to handle new data items as they are provided.
  Author:
    Ron Sigal

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected ResteasyAsynchronousResponse` | `asyncResponse` |
    `protected Map<Class<?>,​Object>` | `contextDataMap` |
    `protected SynchronousDispatcher` | `dispatcher` |
    `protected boolean` | `isComplete` |
    `protected ResourceMethodInvoker` | `method` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AsyncResponseConsumer​(ResourceMethodInvoker method)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected Type` | `adaptGenericType​(Type unwrappedType)` |
    `void` | `complete​(Throwable t)` |
    `protected BuiltResponse` | `createResponse​(Object entity, HttpRequest httpRequest)` |
    `protected void` | `doComplete()` |
    `protected void` | `internalResume​(Object entity, Consumer<Throwable> onComplete)` |
    `protected void` | `internalResume​(Throwable t, Consumer<Throwable> onComplete)` |
    `static AsyncResponseConsumer` | `makeAsyncResponseConsumer​(ResourceMethodInvoker method, AsyncResponseProvider<?> asyncResponseProvider)` |
    `static AsyncResponseConsumer` | `makeAsyncResponseConsumer​(ResourceMethodInvoker method, AsyncStreamProvider<?> asyncStreamProvider)` |
    `protected void` | `sendBuiltResponse​(BuiltResponse builtResponse, HttpRequest httpRequest, HttpResponse httpResponse, Consumer<Throwable> onComplete)` |
    `protected abstract boolean` | `sendHeaders()` |
    `abstract void` | `subscribe​(Object rtn)` |

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

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

- - ### Field Detail

    - #### contextDataMap

          protected Map<Class<?>,​Object> contextDataMap

    - #### method

          protected ResourceMethodInvoker method

    - #### dispatcher

          protected SynchronousDispatcher dispatcher

    - #### asyncResponse

          protected ResteasyAsynchronousResponse asyncResponse

    - #### isComplete

          protected boolean isComplete

  - ### Constructor Detail

    - #### AsyncResponseConsumer

          public AsyncResponseConsumer​(ResourceMethodInvoker method)

  - ### Method Detail

    - #### makeAsyncResponseConsumer

          public static AsyncResponseConsumer makeAsyncResponseConsumer​(ResourceMethodInvoker method,
                                                                        AsyncResponseProvider<?> asyncResponseProvider)

    - #### makeAsyncResponseConsumer

          public static AsyncResponseConsumer makeAsyncResponseConsumer​(ResourceMethodInvoker method,
                                                                        AsyncStreamProvider<?> asyncStreamProvider)

    - #### doComplete

          protected void doComplete()

    - #### complete

          public final void complete​(Throwable t)

    - #### internalResume

          protected void internalResume​(Object entity,
                                        Consumer<Throwable> onComplete)

    - #### sendBuiltResponse

          protected void sendBuiltResponse​(BuiltResponse builtResponse,
                                           HttpRequest httpRequest,
                                           HttpResponse httpResponse,
                                           Consumer<Throwable> onComplete)
                                    throws IOException

      Throws:
        `IOException`

    - #### sendHeaders

          protected abstract boolean sendHeaders()

    - #### internalResume

          protected void internalResume​(Throwable t,
                                        Consumer<Throwable> onComplete)

    - #### createResponse

          protected BuiltResponse createResponse​(Object entity,
                                                 HttpRequest httpRequest)

    - #### adaptGenericType

          protected Type adaptGenericType​(Type unwrappedType)

    - #### subscribe

          public abstract void subscribe​(Object rtn)