Package org.jboss.resteasy.core

## Class SynchronousDispatcher

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

- All Implemented Interfaces:
    `Dispatcher`
  Direct Known Subclasses:
    `AsynchronousDispatcher`

      public class SynchronousDispatcher
      extends Object
      implements Dispatcher

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected boolean` | `bufferExceptionEntity` |
    `protected boolean` | `bufferExceptionEntityRead` |
    `protected Map<Class,​Object>` | `defaultContextObjects` |
    `protected ResteasyProviderFactory` | `providerFactory` |
    `protected Registry` | `registry` |
    `protected List<HttpRequestPreprocessor>` | `requestPreprocessors` |
    `protected Set<String>` | `unwrappedExceptions` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SynchronousDispatcher​(ResteasyProviderFactory providerFactory)` |
    `SynchronousDispatcher​(ResteasyProviderFactory providerFactory, ResourceMethodRegistry registry)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addHttpPreprocessor​(HttpRequestPreprocessor httpPreprocessor)` |
    `void` | `asynchronousDelivery​(HttpRequest request, HttpResponse response, javax.ws.rs.core.Response jaxrsResponse)` | Deprecated.
    `void` | `asynchronousDelivery​(HttpRequest request, HttpResponse response, javax.ws.rs.core.Response jaxrsResponse, Consumer<Throwable> onComplete)` |
    `void` | `asynchronousExceptionDelivery​(HttpRequest request, HttpResponse response, Throwable exception)` | Deprecated.
    `void` | `asynchronousExceptionDelivery​(HttpRequest request, HttpResponse response, Throwable exception, Consumer<Throwable> onComplete)` |
    `void` | `clearContextData()` |
    `javax.ws.rs.core.Response` | `execute​(HttpRequest request, HttpResponse response, ResourceInvoker invoker)` | Return a response wither from an invoke or exception handling.
    `Map<Class,​Object>` | `getDefaultContextObjects()` |
    `ResourceInvoker` | `getInvoker​(HttpRequest request)` |
    `ResteasyProviderFactory` | `getProviderFactory()` |
    `Registry` | `getRegistry()` |
    `Set<String>` | `getUnwrappedExceptions()` |
    `javax.ws.rs.core.Response` | `internalInvocation​(HttpRequest request, HttpResponse response, Object entity)` |
    `void` | `invoke​(HttpRequest request, HttpResponse response)` |
    `void` | `invoke​(HttpRequest request, HttpResponse response, ResourceInvoker invoker)` | Invoke and write response.
    `void` | `invokePropagateNotFound​(HttpRequest request, HttpResponse response)` | Propagate NotFoundException.
    `javax.ws.rs.core.Response` | `preprocess​(HttpRequest request)` |
    `protected void` | `preprocess​(HttpRequest request, HttpResponse response, Runnable continuation)` | Call pre-process ContainerRequestFilters.
    `void` | `pushContextObjects​(HttpRequest request, HttpResponse response)` |
    `static <T extends Throwable> void` | `rethrow​(Throwable t)` |
    `void` | `unhandledAsynchronousException​(HttpResponse response, Throwable ex)` |
    `void` | `writeException​(HttpRequest request, HttpResponse response, Throwable e)` | Deprecated.
    `void` | `writeException​(HttpRequest request, HttpResponse response, Throwable e, Consumer<Throwable> onComplete)` |
    `protected void` | `writeResponse​(HttpRequest request, HttpResponse response, javax.ws.rs.core.Response jaxrsResponse)` |

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

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

- - ### Field Detail

    - #### providerFactory

          protected ResteasyProviderFactory providerFactory

    - #### registry

          protected Registry registry

    - #### requestPreprocessors

          protected List<HttpRequestPreprocessor> requestPreprocessors

    - #### defaultContextObjects

          protected Map<Class,​Object> defaultContextObjects

    - #### unwrappedExceptions

          protected Set<String> unwrappedExceptions

    - #### bufferExceptionEntityRead

          protected boolean bufferExceptionEntityRead

    - #### bufferExceptionEntity

          protected boolean bufferExceptionEntity

  - ### Constructor Detail

    - #### SynchronousDispatcher

          public SynchronousDispatcher​(ResteasyProviderFactory providerFactory)

    - #### SynchronousDispatcher

          public SynchronousDispatcher​(ResteasyProviderFactory providerFactory,
                                       ResourceMethodRegistry registry)

  - ### Method Detail

    - #### getProviderFactory

          public ResteasyProviderFactory getProviderFactory()

      Specified by:
        `getProviderFactory` in interface `Dispatcher`

    - #### getRegistry

          public Registry getRegistry()

      Specified by:
        `getRegistry` in interface `Dispatcher`

    - #### getDefaultContextObjects

          public Map<Class,​Object> getDefaultContextObjects()

      Specified by:
        `getDefaultContextObjects` in interface `Dispatcher`

    - #### getUnwrappedExceptions

          public Set<String> getUnwrappedExceptions()

    - #### preprocess

          public javax.ws.rs.core.Response preprocess​(HttpRequest request)

    - #### preprocess

          protected void preprocess​(HttpRequest request,
                                    HttpResponse response,
                                    Runnable continuation)

      Call pre-process ContainerRequestFilters.
      Parameters:
        `request` - http request
        `response` - http response
        `continuation` - runnable

    - #### rethrow

          public static <T extends Throwable> void rethrow​(Throwable t)
                                                    throws T extends Throwable

      Throws:
        `T extends Throwable`

    - #### writeException

          @Deprecated
          public void writeException​(HttpRequest request,
                                     HttpResponse response,
                                     Throwable e)

      Deprecated.

    - #### writeException

          public void writeException​(HttpRequest request,
                                     HttpResponse response,
                                     Throwable e,
                                     Consumer<Throwable> onComplete)

    - #### invoke

          public void invoke​(HttpRequest request,
                             HttpResponse response)

      Specified by:
        `invoke` in interface `Dispatcher`

    - #### invokePropagateNotFound

          public void invokePropagateNotFound​(HttpRequest request,
                                              HttpResponse response)
                                       throws javax.ws.rs.NotFoundException

      Propagate NotFoundException. This is used for Filters.
      Parameters:
        `request` - http request
        `response` - http response
      Throws:
        `javax.ws.rs.NotFoundException`

    - #### getInvoker

          public ResourceInvoker getInvoker​(HttpRequest request)
                                     throws Failure

      Throws:
        `Failure`

    - #### pushContextObjects

          public void pushContextObjects​(HttpRequest request,
                                         HttpResponse response)

    - #### internalInvocation

          public javax.ws.rs.core.Response internalInvocation​(HttpRequest request,
                                                              HttpResponse response,
                                                              Object entity)

      Specified by:
        `internalInvocation` in interface `Dispatcher`

    - #### clearContextData

          public void clearContextData()

    - #### execute

          public javax.ws.rs.core.Response execute​(HttpRequest request,
                                                   HttpResponse response,
                                                   ResourceInvoker invoker)

      Return a response wither from an invoke or exception handling.
      Parameters:
        `request` - http request
        `response` - http response
        `invoker` - resource invoker
      Returns:
        response

    - #### invoke

          public void invoke​(HttpRequest request,
                             HttpResponse response,
                             ResourceInvoker invoker)

      Invoke and write response.
      Parameters:
        `request` - http request
        `response` - http response
        `invoker` - resource invoker

    - #### asynchronousDelivery

          @Deprecated
          public void asynchronousDelivery​(HttpRequest request,
                                           HttpResponse response,
                                           javax.ws.rs.core.Response jaxrsResponse)
                                    throws IOException

      Deprecated.
      Throws:
        `IOException`

    - #### asynchronousDelivery

          public void asynchronousDelivery​(HttpRequest request,
                                           HttpResponse response,
                                           javax.ws.rs.core.Response jaxrsResponse,
                                           Consumer<Throwable> onComplete)
                                    throws IOException

      Throws:
        `IOException`

    - #### unhandledAsynchronousException

          public void unhandledAsynchronousException​(HttpResponse response,
                                                     Throwable ex)

    - #### asynchronousExceptionDelivery

          @Deprecated
          public void asynchronousExceptionDelivery​(HttpRequest request,
                                                    HttpResponse response,
                                                    Throwable exception)

      Deprecated.

    - #### asynchronousExceptionDelivery

          public void asynchronousExceptionDelivery​(HttpRequest request,
                                                    HttpResponse response,
                                                    Throwable exception,
                                                    Consumer<Throwable> onComplete)

    - #### writeResponse

          protected void writeResponse​(HttpRequest request,
                                       HttpResponse response,
                                       javax.ws.rs.core.Response jaxrsResponse)

    - #### addHttpPreprocessor

          public void addHttpPreprocessor​(HttpRequestPreprocessor httpPreprocessor)

      Specified by:
        `addHttpPreprocessor` in interface `Dispatcher`