org.appfuse.webapp.action
Class ActionExceptionHandler

java.lang.Object
  extended by org.apache.struts.action.ExceptionHandler
      extended by org.appfuse.webapp.action.ActionExceptionHandler

public final class ActionExceptionHandler
extends ExceptionHandler

Implementation of ExceptionHandler that handles any Exceptions that are bubbled up to the Action layer. This allows us to remove generic try/catch statements from our Action Classes.

View Source

Author:
Matt Raible

Constructor Summary
ActionExceptionHandler()
           
 
Method Summary
 ActionForward execute(Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response)
          This method handles any java.lang.Exceptions that are not caught in previous classes.
protected  void logException(Exception ex)
          Overrides logException method in ExceptionHandler to print the stackTrace
protected  void storeException(HttpServletRequest request, String property, ActionMessage error, ActionForward forward)
          This method overrides the the ExceptionHandler's storeException method in order to create more than one error message.
 
Methods inherited from class org.apache.struts.action.ExceptionHandler
storeException, storeException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionExceptionHandler

public ActionExceptionHandler()
Method Detail

execute

public ActionForward execute(Exception ex,
                             ExceptionConfig ae,
                             ActionMapping mapping,
                             ActionForm formInstance,
                             HttpServletRequest request,
                             HttpServletResponse response)
                      throws ServletException
This method handles any java.lang.Exceptions that are not caught in previous classes. It will loop through and get all the causes (exception chain), create ActionErrors, add them to the request and then forward to the input.

Overrides:
execute in class ExceptionHandler
Throws:
ServletException
See Also:
( java.lang.Exception, org.apache.struts.config.ExceptionConfig, org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse )

storeException

protected void storeException(HttpServletRequest request,
                              String property,
                              ActionMessage error,
                              ActionForward forward)
This method overrides the the ExceptionHandler's storeException method in order to create more than one error message.

Parameters:
request - - The request we are handling
property - - The property name to use for this error
error - - The error generated from the exception mapping
forward - - The forward generated from the input path (from the form or exception mapping)

logException

protected void logException(Exception ex)
Overrides logException method in ExceptionHandler to print the stackTrace

Overrides:
logException in class ExceptionHandler
See Also:
ExceptionHandler.logException(java.lang.Exception)


Copyright � 2002-2006