public class FacesMessageExceptionHandler
extends javax.faces.context.ExceptionHandlerWrapper
FacesMessageExceptionHandlerFactory
to see how to set this up.
Note: it's your own responsibility to make sure that the faces messages are being shown. Make sure
that there's a <h:messages>
or any equivalent component (OmniFaces, PrimeFaces, etc) is present
in the view and that it can handle global messages and that it's explicitly or automatically updated in case of ajax
requests. Also make sure that you don't have bugs in rendering of your views. This exception handler is not capable
of handling exceptions during render response. It will fail silently.
If more fine grained control of creating the FATAL faces message is desired, then the developer can opt to extend
this FacesMessageExceptionHandler
and override the following method:
FacesMessageExceptionHandlerFactory
Constructor and Description |
---|
FacesMessageExceptionHandler(javax.faces.context.ExceptionHandler wrapped)
Construct a new faces message exception handler around the given wrapped exception handler.
|
Modifier and Type | Method and Description |
---|---|
protected String |
createFatalMessage(Throwable exception)
Create fatal message based on given exception which will in turn be passed to
FacesContext.addMessage(String, javax.faces.application.FacesMessage) . |
javax.faces.context.ExceptionHandler |
getWrapped() |
void |
handle()
Set every exception as a global FATAL faces message.
|
public FacesMessageExceptionHandler(javax.faces.context.ExceptionHandler wrapped)
wrapped
- The wrapped exception handler.public void handle() throws javax.faces.FacesException
handle
in class javax.faces.context.ExceptionHandlerWrapper
javax.faces.FacesException
protected String createFatalMessage(Throwable exception)
FacesContext.addMessage(String, javax.faces.application.FacesMessage)
.
The default implementation returns Throwable.toString()
.exception
- The exception to create fatal message for.public javax.faces.context.ExceptionHandler getWrapped()
getWrapped
in interface javax.faces.FacesWrapper<javax.faces.context.ExceptionHandler>
getWrapped
in class javax.faces.context.ExceptionHandlerWrapper
Copyright © 2012–2014 OmniFaces. All rights reserved.