On 1/19/07, Reynolds, James <[EMAIL PROTECTED]> wrote:
I have a question about the org.apache.shale.view.ExceptionHandler
interface. Comments in the Shale Wiki indicate that Shale "...can
optionally do a RequestDispatcher.forward() call to the context relative
path of an error display page..." How do I invoke the option to forward
to my error page?
I've created my ExceptionHandler class (code below) and configured it
successfully. I also configured this parameter in my web.xml:
<context-param>
<param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH</param-name>
<param-value>/exceptionViewer.jsf</param-value>
</context-param>
ExceptionHandler code:
public class WebEnabledExceptionHandler implements ExceptionHandler {
public WebEnabledExceptionHandler(){
}
public void handleException(Exception exception) {
System.out.println("Shale ExceptionHandler: " +
exception.getMessage());
// How do I forward to the error page?
}
}
Thanks!
It's magic :-).
Actually, the act of declaring the forward path (as you are doing here)
enables the forwarding automatically. The code that actually does this is
the afterPhaseExceptionCheck() method in ViewPhaseListener, which is called
at the end of each phase. IF any exceptions have been queued up, AND the
web.xml declares a forwarding path, THEN it will do the forwarding. You do
not need to provide a custom ExceptionHandler to accomplish this.
Craig
E-Mail messages may contain viruses, worms, or other malicious code. By
reading the message and opening any attachments, the recipient accepts full
responsibility for taking protective action against such code. Sender is not
liable for any loss or damage arising from this message.
The information in this e-mail is confidential and may be legally
privileged. It is intended solely for the addressee(s). Access to this
e-mail by anyone else is unauthorized.