pt.digitalis.dif.controller
Class AbstractControllerErrorHandler

java.lang.Object
  extended by pt.digitalis.dif.controller.AbstractControllerErrorHandler
All Implemented Interfaces:
IDispatcherErrorHandler

public abstract class AbstractControllerErrorHandler
extends Object
implements IDispatcherErrorHandler

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Dec 21, 2007

Field Summary
 
Fields inherited from interface pt.digitalis.dif.controller.interfaces.IDispatcherErrorHandler
EXCEPTION, ORIGINAL_REQUEST
 
Constructor Summary
AbstractControllerErrorHandler()
           
 
Method Summary
protected abstract  IDIFResponse buildDynamicErrorResponse(IDIFRequest originalrequest, String errorStageID, Exception exception)
          Builds an error response from a stage id for error handling, with a defined handler stage (or the default one)
protected abstract  IDIFResponse buildStaticErrorResponse(IDIFRequest originalrequest, Exception exception)
          Builds an error response from a static resource for simple rendering for when the DIF has generated errors
 IDIFResponse processException(IDIFRequest originalRequest, BusinessFlowException businessFlowException)
          Process an exception and determine the resulting action response
 IDIFResponse processException(IDIFRequest originalRequest, ControllerException controllerException)
          Process an exception and determine the resulting action response
 IDIFResponse processException(IDIFRequest originalRequest, RuntimeException runtimeException)
          Process an exception and determine the resulting action response
 IDIFResponse responseWithContext(IDIFResponse response, IDIFRequest originalRequest, Exception exception)
          Creates a new error request base on the original request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.digitalis.dif.controller.interfaces.IDispatcherErrorHandler
getDefaultErrorResponse
 

Constructor Detail

AbstractControllerErrorHandler

public AbstractControllerErrorHandler()
Method Detail

buildDynamicErrorResponse

protected abstract IDIFResponse buildDynamicErrorResponse(IDIFRequest originalrequest,
                                                          String errorStageID,
                                                          Exception exception)
Builds an error response from a stage id for error handling, with a defined handler stage (or the default one)

Parameters:
originalrequest - the original request
errorStageID - the error stage to redirect to. If null will redirect to the default error stage
exception - the exception launched
Returns:
the response

buildStaticErrorResponse

protected abstract IDIFResponse buildStaticErrorResponse(IDIFRequest originalrequest,
                                                         Exception exception)
Builds an error response from a static resource for simple rendering for when the DIF has generated errors

Parameters:
originalrequest - the original request
exception - the exception launched
Returns:
the response

processException

public IDIFResponse processException(IDIFRequest originalRequest,
                                     BusinessFlowException businessFlowException)
Description copied from interface: IDispatcherErrorHandler
Process an exception and determine the resulting action response

Specified by:
processException in interface IDispatcherErrorHandler
Parameters:
originalRequest - the request that generated the error
Returns:
the calculated response to the given error
See Also:
IDispatcherErrorHandler.processException(pt.digitalis.dif.controller.interfaces.IDIFRequest, pt.digitalis.dif.exception.controller.BusinessFlowException)

processException

public IDIFResponse processException(IDIFRequest originalRequest,
                                     ControllerException controllerException)
Description copied from interface: IDispatcherErrorHandler
Process an exception and determine the resulting action response

Specified by:
processException in interface IDispatcherErrorHandler
Parameters:
originalRequest - the request that generated the error
Returns:
the calculated response to the given error
See Also:
IDispatcherErrorHandler.processException(pt.digitalis.dif.controller.interfaces.IDIFRequest, pt.digitalis.dif.exception.controller.ControllerException)

processException

public IDIFResponse processException(IDIFRequest originalRequest,
                                     RuntimeException runtimeException)
Description copied from interface: IDispatcherErrorHandler
Process an exception and determine the resulting action response

Specified by:
processException in interface IDispatcherErrorHandler
Parameters:
originalRequest - the request that generated the error
Returns:
the calculated response to the given error
See Also:
IDispatcherErrorHandler.processException(pt.digitalis.dif.controller.interfaces.IDIFRequest, java.lang.RuntimeException)

responseWithContext

public IDIFResponse responseWithContext(IDIFResponse response,
                                        IDIFRequest originalRequest,
                                        Exception exception)
Creates a new error request base on the original request. Injects the original request in the error one for later reference in the error stage.

Parameters:
response - the response to add the context to
originalRequest - the original request
exception - the exception launched
Returns:
the request with the context added


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.