Top Description Constructors Methods
javax.faces.context

public abstract Class ExceptionHandler

extends Object
implements SystemEventListener
Class Inheritance
All Implemented Interfaces
javax.faces.event.SystemEventListener, javax.faces.event.FacesListener, java.util.EventListener
Known Direct Subclasses
javax.faces.context.ExceptionHandlerWrapper, javax.faces.webapp.PreJsf2ExceptionHandlerFactory.PreJsf2ExceptionHandler, com.sun.faces.context.ExceptionHandlerImpl
Imports
javax.faces.FacesException, javax.faces.event.AbortProcessingException, .ExceptionQueuedEvent, .SystemEvent, .SystemEventListener

ExceptionHandler is the central point for handling unexpected Exceptions that are thrown during the Faces lifecycle. The ExceptionHandler must not be notified of any Exceptions that occur during application startup or shutdown.

See the specification prose document for the requirements for the default implementation. Exceptions may be passed to the ExceptionHandler in one of two ways:

With either approach, any ExceptionQueuedEvent instances that are published in this way are accessible to the handle method, which is called at the end of each lifecycle phase, as specified in section JSF.6.2.

Note that if handle happens to be invoked during javax.faces.event.PhaseId#RENDER_RESPONSE, the recovery options are more limited than when it is invoked during other phases. Specifically, it is not valid to call javax.faces.application.NavigationHandler#handleNavigation during RENDER_RESPONSE.

Instances of this class are request scoped and are created by virtue of FacesContextFactory#getFacesContext calling ExceptionHandlerFactory#getExceptionHandler.

Since
2.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract ExceptionQueuedEvent

Returns:

instance of ExceptionQueuedEvent.
getHandledExceptionQueuedEvent
()

Return the first ExceptionQueuedEvent handled by this handler.

public abstract Iterable<ExceptionQueuedEvent>

Returns:

an Iterable over all ExceptionQueuedEvents.
getHandledExceptionQueuedEvents
()

The default implementation must return an Iterable over all ExceptionQueuedEvents that have been handled by the handle method.

public abstract Throwable

Returns:

unwrapped object.
getRootCause
(Throwable
passed-in wrapped Throwable.
t
)

Unwrap the argument t until the unwrapping encounters an Object whose getClass() is not equal to FacesException.class or javax.el.ELException.class.

public abstract Iterable<ExceptionQueuedEvent>

Returns:

the unhandled set of ExceptionQueuedEvents.
getUnhandledExceptionQueuedEvents
()

Return an Iterable over all ExceptionQueuedEvents that have not yet been handled by the handle method.

public abstract void
handle()

Take action to handle the Exception instances residing inside the ExceptionQueuedEvent instances that have been queued by calls to Application().publishEvent(ExceptionQueuedEvent.class, eventContext).

public abstract boolean
isListenerForSource(Object
the source that is inquiring about the appropriateness of sending an event to this listener instance.
source
)

Redeclares javax.faces.event.SystemEventListener.isListenerForSource.

This method must return true if and only if this listener instance is interested in receiving events from the instance referenced by the source parameter.

public abstract void
processEvent(SystemEvent
the SystemEvent instance that is being processed.
exceptionQueuedEvent
)

Redeclares javax.faces.event.SystemEventListener.processEvent.

When called, the listener can assume that any guarantees given in the javadoc for the specific SystemEvent subclass are true.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ExceptionHandlerback to summary
public ExceptionHandler()

Method Detail

getHandledExceptionQueuedEventback to summary
public abstract ExceptionQueuedEvent getHandledExceptionQueuedEvent()

Return the first ExceptionQueuedEvent handled by this handler.

Returns:ExceptionQueuedEvent

instance of ExceptionQueuedEvent.

getHandledExceptionQueuedEventsback to summary
public abstract Iterable<ExceptionQueuedEvent> getHandledExceptionQueuedEvents()

The default implementation must return an Iterable over all ExceptionQueuedEvents that have been handled by the handle method.

Returns:Iterable<ExceptionQueuedEvent>

an Iterable over all ExceptionQueuedEvents.

getRootCauseback to summary
public abstract Throwable getRootCause(Throwable t)

Unwrap the argument t until the unwrapping encounters an Object whose getClass() is not equal to FacesException.class or javax.el.ELException.class. If there is no root cause, null is returned.

Parameters
t:Throwable

passed-in wrapped Throwable.

Returns:Throwable

unwrapped object.

Exceptions
NullPointerException:
if argument t is null.
Since
2.0
getUnhandledExceptionQueuedEventsback to summary
public abstract Iterable<ExceptionQueuedEvent> getUnhandledExceptionQueuedEvents()

Return an Iterable over all ExceptionQueuedEvents that have not yet been handled by the handle method.

Returns:Iterable<ExceptionQueuedEvent>

the unhandled set of ExceptionQueuedEvents.

handleback to summary
public abstract void handle() throws FacesException

Take action to handle the Exception instances residing inside the ExceptionQueuedEvent instances that have been queued by calls to Application().publishEvent(ExceptionQueuedEvent.class, eventContext). The requirements of the default implementation are detailed in section JSF.6.2.1.

Exceptions
FacesException:
if and only if a problem occurs while performing the algorithm to handle the Exception, not as a means of conveying a handled Exception itself.
Since
2.0
isListenerForSourceback to summary
public abstract boolean isListenerForSource(Object source)

Redeclares javax.faces.event.SystemEventListener.isListenerForSource.

Doc from javax.faces.event.SystemEventListener.isListenerForSource.

This method must return true if and only if this listener instance is interested in receiving events from the instance referenced by the source parameter.

Parameters
source:Object

the source that is inquiring about the appropriateness of sending an event to this listener instance.

Returns:boolean

the value as specified above

Annotations
@Override
processEventback to summary
public abstract void processEvent(SystemEvent exceptionQueuedEvent) throws AbortProcessingException

Redeclares javax.faces.event.SystemEventListener.processEvent.

Doc from javax.faces.event.SystemEventListener.processEvent.

When called, the listener can assume that any guarantees given in the javadoc for the specific SystemEvent subclass are true.

Parameters
exceptionQueuedEvent:SystemEvent

the SystemEvent instance that is being processed.

Annotations
@Override
Exceptions
AbortProcessingException:
if lifecycle processing should cease for this request.