Hi,
http://wiki.apache.org/myfaces/Handling_Server_Errors
Cagatay
On 4/17/07, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>From: "Mike Quilleash " <[EMAIL PROTECTED]>
>
>Hi all,
>I am trying to come up with a way to catch all exceptions that occur
during the JSF lifecycle.
>When this happens I want to display a debug page with useful info; stack
trace, current view,
> component tree, session state etc.
>
>I'm having trouble finding a good place to insert logic like this.
>
>PhaseListener - no good, only run before and after, not during phases.
>Servlet Filter - will catch everything but FacesContext is destroyed by
this point so no access
> to the component tree.
>FacesServlet - final, not sure I want to override this anyway
>Lifecycle - possibility, but again, not sure I want to override this.
>
>Does anyone have an experience of plugging in a generic exception handler
somewhere
>in the framework?
>
The Shale view controller [1] subclasses the view root[2][3] in order hook
into the methods on the root that are invoked by the life cycle. This will
only work for the Myfaces JSF 1.1 implementation. The RI 1.1 doesn't use
the JSF component factory to instantiate the view root.
In the shale view controller, you can register your own error page or you
can plug in your own exception handler. In working with the ADF Faces
library (not Trinidad), I had to implement my own exception handler do to
competing extension points.
<context-param>
<param-name>org.apache.shale.view.EXCEPTION_DISPATCH_PATH
</param-name>
<param-value>/error.jsf</param-value>
</context-param>
[1] http://shale.apache.org/shale-view/index.html
[2]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-view/src/main/java/org/apache/shale/view/faces/ShaleViewRoot.java?view=markup
[3]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-view/src/main/resources/META-INF/faces-config.xml?view=markup
>Cheers.
>Mike.
Gary