I am trying to write my own exception handler as per the details at
http://wiki.apache.org/myfaces/Handling_Server_Errors
I tried to override handleException(fc,ex) method as following
public void handleException(FacesContext fc, Exception ex) throws Throwable
{
log.error("Exception occured...", ex);
if(ex is of sometype){
NavigationHandler nh =
fc.getApplication().getNavigationHandler();
nh.handleNavigation(fc, null, "exceptionNavigation");
fc.renderResponse();
} else {
throw ex;
}
}
in web.xml
----------
<error-page>
<error-code>500</error-code>
<location>/errorDisplay.xhtml</location>
</error-page>
navigation rule
--------------
<navigation-rule>
<navigation-case>
<from-outcome>exceptionNavigation</from-outcome>
<to-view-id>/errorPages/errorHtml.html</to-view-id>
</navigation-case>
</navigation-rule>
The handleException() method gets invoked but never redirects to
errorHtml.html for if case, and it also fails for else case. If I get the
error 500 and as per web.xml it should redirect errorDisplay.xhtml instead
it shows whole stack trace on the web page.
The functionality I am looking is:
- Catch the exception in handleException() method
- log the error
- If error is certain type redirect to static html/jsf page using navigation
handler
- else throw the exception
- handle 500/404 and other exceptions using web.xml error pages
configuration
- if possible populate a bean with error messages or add messages to
FacesContext and redirect a standard jsf file where we display <h:messages>
I appreciate help on this.
--
View this message in context:
http://www.nabble.com/Handling-Server-Errors-tp17628641p17628641.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.