Reputation: 159
I'm using FullAjaxExeptionHandler from omnifaces library and it all works well, however I'm not sure how to show the exception in PrimeFaces dialog on the page where exception happened. Currently I can only redirect user to exception page as described on omnifaces showcase.
What I have now:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/errorpages/bug.xhtml</location>
</error-page>
What I want:
<error-page>
<exception-type>java.lang.RuntimeException</exception-type>
<location>/currentpage.xhtml?showExceptionDialog(exception)</location>
</error-page>
Thanks.
Upvotes: 1
Views: 842
Reputation: 1109292
The FullAjaxExceptionHandler
doesn't support it. The FullAjaxExceptionHandler
is designed to achieve exactly the same behavior as if it were a non-ajax request. I.e. make use of web.xml
specified <error-page>
entries as per standard Servlet API.
Also, OmniFaces is not intented as an extension to specifically PrimeFaces, so it isn't possible to use any PrimeFaces specific APIs like RequestContext
or the 4.0 "dialog framework" in FullAjaxExceptionHandler
. It would make it unusable in projects where PrimeFaces isn't being used but a different component library.
Your best bet is indeed to create your own exception handler. You're completely free to take over parts of the source code of FullAjaxExceptionHandler
as long as you respect the Apache license. An alternative would be to request PrimeFaces Extensions to create and add the exception handler you had in mind to its standard set.
Upvotes: 1