Class ExceptionQueuedEventContext
- All Implemented Interfaces:
SystemEventListenerHolder
This helper class provides context to the ExceptionQueuedEvent regarding the state of the system at the point
in time when the ExceptionQueuedEvent occurs and links the ExceptionQueuedEvent to the
ExceptionHandler by virtue of implementing SystemEventListener.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe presence of an entry under this key in theMapreturned fromgetAttributes()indicates the event occurred during the “after phase” part of the current lifecycle phase.static final StringThe presence of an entry under this key in theMapreturned fromgetAttributes()indicates the event occurred during the “before phase” part of the current lifecycle phase. -
Constructor Summary
ConstructorsConstructorDescriptionExceptionQueuedEventContext(FacesContext context, Throwable thrown) Instantiate a newExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred.ExceptionQueuedEventContext(FacesContext context, Throwable thrown, UIComponent component) Instantiate a newExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred, relevant to the argumentcomponent.ExceptionQueuedEventContext(FacesContext context, Throwable thrown, UIComponent component, PhaseId phaseId) Instantiate a newExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred, relevant to the argumentcomponent, during the lifecycle phasephaseId. -
Method Summary
Modifier and TypeMethodDescriptionAMapof attributes relevant to the context of thisExceptionQueuedEvent.Return theUIComponentwhich was being processed when the exception was thrown.TheFacesContextfor this request.Return theexceptionproperty.getListenersForEventClass(Class<? extends SystemEvent> facesEventClass) Return aListthat contains a single entry, theExceptionHandlerfor the current request.Return thePhaseIdwhich was being processed when the exception was thrown.booleanboolean
-
Field Details
-
IN_BEFORE_PHASE_KEY
The presence of an entry under this key in the
Mapreturned fromgetAttributes()indicates the event occurred during the “before phase” part of the current lifecycle phase. -
IN_AFTER_PHASE_KEY
The presence of an entry under this key in the
Mapreturned fromgetAttributes()indicates the event occurred during the “after phase” part of the current lifecycle phase.
-
-
Constructor Details
-
ExceptionQueuedEventContext
Instantiate a new
ExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred.- Parameters:
context-FacesContextfor the current requestthrown- theThrowablethat is the context for thisExceptionQueuedEventContextinstance.
-
ExceptionQueuedEventContext
Instantiate a new
ExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred, relevant to the argumentcomponent.- Parameters:
context-FacesContextfor the current requestthrown- theThrowablethat is the context for thisExceptionQueuedEventContextinstance.component- theUIComponentinstance to which thisExceptionQueuedEventContextpertains
-
ExceptionQueuedEventContext
public ExceptionQueuedEventContext(FacesContext context, Throwable thrown, UIComponent component, PhaseId phaseId) Instantiate a new
ExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred, relevant to the argumentcomponent, during the lifecycle phasephaseId.- Parameters:
context-FacesContextfor the current requestthrown- theThrowablethat is the context for thisExceptionQueuedEventContextinstance.component- theUIComponentthat is relevant to the context.phaseId- thePhaseIdat the time thisExeceptionEventContextis created.
-
-
Method Details
-
getContext
The
FacesContextfor this request.- Returns:
- the
FacesContextused to create thisExceptionQueuedEventContextinstance.
-
getException
Return the
exceptionproperty.- Returns:
- the exception
-
getComponent
Return the
UIComponentwhich was being processed when the exception was thrown. If none or not available, this will benull.- Returns:
- the component
-
getPhaseId
Return the
PhaseIdwhich was being processed when the exception was thrown. If none or not available, this will benull.- Returns:
- the phase id
-
inBeforePhase
public boolean inBeforePhase()- Returns:
trueif the exception occurred during thebefore phaseprocessing for a particular lifecycle phase
-
inAfterPhase
public boolean inAfterPhase()- Returns:
trueif the exception occurred during theafter phaseprocessing for a particular lifecycle phase
-
getAttributes
A
Mapof attributes relevant to the context of thisExceptionQueuedEvent.- Returns:
- attributes related to this context
-
getListenersForEventClass
public List<SystemEventListener> getListenersForEventClass(Class<? extends SystemEvent> facesEventClass) Return a
Listthat contains a single entry, theExceptionHandlerfor the current request.- Specified by:
getListenersForEventClassin interfaceSystemEventListenerHolder- Parameters:
facesEventClass- the class for which listeners are to be returned- Returns:
- the listeners for the argument class
-