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
controllerFactory
private final ControllerFactory controllerFactory
beanManager
private final javax.enterprise.inject.spi.BeanManager beanManager
errorViewResolver
private final ViewResolver errorViewResolver
ErrorHandler
@Inject
public ErrorHandler(@Delegate
RouteProcessor delegate,
ViewResolver viewResolver,
ControllerFactory controllerFactory,
javax.enterprise.inject.spi.BeanManager beanManager)
process
public void 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.
invokeErrorRoute
private void invokeErrorRoute(Route errorRoute,
Throwable t)
throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
forwardErrorToView
private void forwardErrorToView(Route errorRoute,
Throwable rootCause,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
getController
private Object getController(Route route)
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.