com.mockrunner.struts
Interface ExceptionHandlerConfig

All Known Implementing Classes:
DefaultExceptionHandlerConfig

public interface ExceptionHandlerConfig

Generic interface for exception handlers. The default implementation is DefaultExceptionHandlerConfig and uses the Struts exception handling mechanism. In special cases, you may provide your own implementations of this interface, that may be independent from the Struts exception handling mechanism. Exception handler are called if an action throws an exception. Use ActionTestModule.addExceptionHandler(com.mockrunner.struts.ExceptionHandlerConfig) to register an exception handler.


Method Summary
 boolean canHandle(java.lang.Exception exception)
          Returns if this handler is able to handle the exception.
 java.lang.Object handle(java.lang.Exception exception, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles the exception.
 

Method Detail

canHandle

boolean canHandle(java.lang.Exception exception)
Returns if this handler is able to handle the exception.

Returns:
true if this handler is able to handle the exception, false otherwise

handle

java.lang.Object handle(java.lang.Exception exception,
                        org.apache.struts.action.ActionMapping mapping,
                        org.apache.struts.action.ActionForm form,
                        javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                        throws java.lang.Exception
Handles the exception.

Parameters:
exception - the exception
mapping - the current ActionMapping
form - the current ActionForm
request - the current request
response - the current response
Returns:
the handler return value, usually an ActionForward, but may be any object
Throws:
java.lang.Exception