org.jboss.resteasy.core
Class SynchronousDispatcher

java.lang.Object
  extended by org.jboss.resteasy.core.SynchronousDispatcher
All Implemented Interfaces:
Dispatcher
Direct Known Subclasses:
AsynchronousDispatcher

public class SynchronousDispatcher
extends java.lang.Object
implements Dispatcher

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
protected  java.util.Map<java.lang.Class,java.lang.Object> defaultContextObjects
           
protected  ExtensionHttpPreprocessor extentionHttpPreprocessor
           
protected  ResteasyProviderFactory providerFactory
           
protected  Registry registry
           
protected  java.util.List<HttpRequestPreprocessor> requestPreprocessors
           
protected  java.util.Set<java.lang.String> unwrappedExceptions
           
 
Constructor Summary
SynchronousDispatcher(ResteasyProviderFactory providerFactory)
           
 
Method Summary
 void addHttpPreprocessor(HttpRequestPreprocessor httpPreprocessor)
           
 void asynchronousDelivery(HttpRequest request, HttpResponse response, Response jaxrsResponse)
           
 void clearContextData()
           
 boolean executeExactExceptionMapper(HttpRequest request, HttpResponse response, java.lang.Throwable exception)
          If there exists an Exception mapper for exception, execute it, otherwise, do NOT recurse up class hierarchy of exception.
 boolean executeExceptionMapper(HttpRequest request, HttpResponse response, java.lang.Throwable exception)
          Execute an ExceptionMapper if one exists for the given exception.
 java.util.Map<java.lang.Class,java.lang.Object> getDefaultContextObjects()
           
 ResourceInvoker getInvoker(HttpRequest request)
           
 java.util.Map<java.lang.String,java.lang.String> getLanguageMappings()
           
 java.util.Map<java.lang.String,MediaType> getMediaTypeMappings()
           
 ResteasyProviderFactory getProviderFactory()
           
 Registry getRegistry()
           
protected  Response getResponse(HttpRequest request, HttpResponse response, ResourceInvoker invoker)
           
 java.util.Set<java.lang.String> getUnwrappedExceptions()
           
protected  void handleApplicationException(HttpRequest request, HttpResponse response, ApplicationException e)
           
 void handleException(HttpRequest request, HttpResponse response, java.lang.Exception e)
           
protected  void handleFailure(HttpRequest request, HttpResponse response, Failure failure)
           
 void handleInvokerException(HttpRequest request, HttpResponse response, java.lang.Exception e)
          Called if method invoke was unsuccessful
protected  void handleReaderException(HttpRequest request, HttpResponse response, ReaderException e)
           
protected  void handleWebApplicationException(HttpRequest request, HttpResponse response, WebApplicationException wae)
           
 void handleWriteResponseException(HttpRequest request, HttpResponse response, java.lang.Exception e)
          Called if method invoke was successful, but writing the Response after was not.
protected  void handleWriterException(HttpRequest request, HttpResponse response, WriterException e)
           
 Response internalInvocation(HttpRequest request, HttpResponse response, java.lang.Object entity)
           
 void invoke(HttpRequest request, HttpResponse response)
           
 void invoke(HttpRequest request, HttpResponse response, ResourceInvoker invoker)
           
 void invokePropagateNotFound(HttpRequest request, HttpResponse response)
          Propagate NotFoundException.
protected  void preprocess(HttpRequest in)
           
protected  void preprocessExtensions(HttpRequest in)
           
 void pushContextObjects(HttpRequest request, HttpResponse response)
           
protected  MediaType resolveContentTypeByAccept(java.util.List<MediaType> accepts, java.lang.Object entity)
           
 void setLanguageMappings(java.util.Map<java.lang.String,java.lang.String> languageMappings)
           
 void setMediaTypeMappings(java.util.Map<java.lang.String,MediaType> mediaTypeMappings)
           
protected  void unwrapException(HttpRequest request, HttpResponse response, java.lang.Throwable e)
           
protected  void writeFailure(HttpRequest request, HttpResponse response, Response jaxrsResponse)
           
protected  void writeJaxrsResponse(HttpRequest request, HttpResponse response, 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 java.util.List<HttpRequestPreprocessor> requestPreprocessors

extentionHttpPreprocessor

protected ExtensionHttpPreprocessor extentionHttpPreprocessor

defaultContextObjects

protected java.util.Map<java.lang.Class,java.lang.Object> defaultContextObjects

unwrappedExceptions

protected java.util.Set<java.lang.String> unwrappedExceptions
Constructor Detail

SynchronousDispatcher

public SynchronousDispatcher(ResteasyProviderFactory providerFactory)
Method Detail

getProviderFactory

public ResteasyProviderFactory getProviderFactory()
Specified by:
getProviderFactory in interface Dispatcher

getRegistry

public Registry getRegistry()
Specified by:
getRegistry in interface Dispatcher

setMediaTypeMappings

public void setMediaTypeMappings(java.util.Map<java.lang.String,MediaType> mediaTypeMappings)
Specified by:
setMediaTypeMappings in interface Dispatcher

setLanguageMappings

public void setLanguageMappings(java.util.Map<java.lang.String,java.lang.String> languageMappings)
Specified by:
setLanguageMappings in interface Dispatcher

getMediaTypeMappings

public java.util.Map<java.lang.String,MediaType> getMediaTypeMappings()
Specified by:
getMediaTypeMappings in interface Dispatcher

getDefaultContextObjects

public java.util.Map<java.lang.Class,java.lang.Object> getDefaultContextObjects()
Specified by:
getDefaultContextObjects in interface Dispatcher

getLanguageMappings

public java.util.Map<java.lang.String,java.lang.String> getLanguageMappings()
Specified by:
getLanguageMappings in interface Dispatcher

getUnwrappedExceptions

public java.util.Set<java.lang.String> getUnwrappedExceptions()

preprocess

protected void preprocess(HttpRequest in)

preprocessExtensions

protected void preprocessExtensions(HttpRequest in)

invoke

public void invoke(HttpRequest request,
                   HttpResponse response)
Specified by:
invoke in interface Dispatcher

invokePropagateNotFound

public void invokePropagateNotFound(HttpRequest request,
                                    HttpResponse response)
                             throws NotFoundException
Propagate NotFoundException. This is used for Filters

Parameters:
request -
response -
Throws:
NotFoundException

getInvoker

public ResourceInvoker getInvoker(HttpRequest request)
                           throws Failure
Throws:
Failure

handleInvokerException

public void handleInvokerException(HttpRequest request,
                                   HttpResponse response,
                                   java.lang.Exception e)
Called if method invoke was unsuccessful

Parameters:
request -
response -
e -

handleWriteResponseException

public void handleWriteResponseException(HttpRequest request,
                                         HttpResponse response,
                                         java.lang.Exception e)
Called if method invoke was successful, but writing the Response after was not.

Parameters:
request -
response -
e -

handleException

public void handleException(HttpRequest request,
                            HttpResponse response,
                            java.lang.Exception e)

handleFailure

protected void handleFailure(HttpRequest request,
                             HttpResponse response,
                             Failure failure)

executeExactExceptionMapper

public boolean executeExactExceptionMapper(HttpRequest request,
                                           HttpResponse response,
                                           java.lang.Throwable exception)
If there exists an Exception mapper for exception, execute it, otherwise, do NOT recurse up class hierarchy of exception.

Parameters:
request -
response -
exception -
Returns:

executeExceptionMapper

public boolean executeExceptionMapper(HttpRequest request,
                                      HttpResponse response,
                                      java.lang.Throwable exception)
Execute an ExceptionMapper if one exists for the given exception. Recurse to base class if not found

Parameters:
response -
exception -
Returns:
true if an ExceptionMapper was found and executed

handleApplicationException

protected void handleApplicationException(HttpRequest request,
                                          HttpResponse response,
                                          ApplicationException e)

unwrapException

protected void unwrapException(HttpRequest request,
                               HttpResponse response,
                               java.lang.Throwable e)

handleWriterException

protected void handleWriterException(HttpRequest request,
                                     HttpResponse response,
                                     WriterException e)

handleReaderException

protected void handleReaderException(HttpRequest request,
                                     HttpResponse response,
                                     ReaderException e)

writeFailure

protected void writeFailure(HttpRequest request,
                            HttpResponse response,
                            Response jaxrsResponse)

handleWebApplicationException

protected void handleWebApplicationException(HttpRequest request,
                                             HttpResponse response,
                                             WebApplicationException wae)

pushContextObjects

public void pushContextObjects(HttpRequest request,
                               HttpResponse response)

internalInvocation

public Response internalInvocation(HttpRequest request,
                                   HttpResponse response,
                                   java.lang.Object entity)
Specified by:
internalInvocation in interface Dispatcher

clearContextData

public void clearContextData()

invoke

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

getResponse

protected Response getResponse(HttpRequest request,
                               HttpResponse response,
                               ResourceInvoker invoker)

asynchronousDelivery

public void asynchronousDelivery(HttpRequest request,
                                 HttpResponse response,
                                 Response jaxrsResponse)

writeJaxrsResponse

protected void writeJaxrsResponse(HttpRequest request,
                                  HttpResponse response,
                                  Response jaxrsResponse)
                           throws WriterException
Throws:
WriterException

resolveContentTypeByAccept

protected MediaType resolveContentTypeByAccept(java.util.List<MediaType> accepts,
                                               java.lang.Object entity)

addHttpPreprocessor

public void addHttpPreprocessor(HttpRequestPreprocessor httpPreprocessor)
Specified by:
addHttpPreprocessor in interface Dispatcher


Copyright © 2010. All Rights Reserved.