org.jboss.aerogear.controller.router.decorators
Class ErrorHandler
java.lang.Object
org.jboss.aerogear.controller.router.decorators.ErrorHandler
- All Implemented Interfaces:
- RouteProcessor
@Decorator
public class ErrorHandler
- extends Object
- implements RouteProcessor
ErrorHandler is a CDI Decorator that decorates a RouteProcessor.
By wrapping the call to RouteProcessor.process(RouteContext) with a try catch block, this class will handle any
exception thrown and either forward to a the appropriate error route configured, or if no error route exists, forward to
the default error view.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
delegate
private final RouteProcessor delegate
endpointInvoker
private EndpointInvoker endpointInvoker
ErrorHandler
@Inject
public ErrorHandler(@Delegate
RouteProcessor delegate,
EndpointInvoker endpointInvoker)
process
public InvocationResult process(RouteContext routeContext)
throws Exception
- Description copied from interface:
RouteProcessor
- Handles the actual invocation of the target or the passed-in
Route.
- Specified by:
process in interface RouteProcessor
- Parameters:
routeContext - the RouteContext for the current request.
- Throws:
Exception - if processing of the route causes an exception.
invokeErrorMethod
private Object invokeErrorMethod(RouteContext errorContext,
Throwable rootCause)
throws Exception
- Throws:
Exception
getMethodArguments
private Object[] getMethodArguments(RouteContext routeContext,
Throwable t)
errorContext
private RouteContext errorContext(Throwable rootCause,
RouteContext orgContext)
wrapRequest
private javax.servlet.http.HttpServletRequest wrapRequest(RouteContext routeContext)
appendAnyMediaTypeToAcceptHeader
private String appendAnyMediaTypeToAcceptHeader(javax.servlet.http.HttpServletRequest request)
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.