Class ExceptionQueuedEventContext
- java.lang.Object
-
- jakarta.faces.event.ExceptionQueuedEventContext
-
- All Implemented Interfaces:
SystemEventListenerHolder
public class ExceptionQueuedEventContext extends Object implements SystemEventListenerHolder
This helper class provides context to the
ExceptionQueuedEventregarding the state of the system at the point in time when theExceptionQueuedEventoccurs and links theExceptionQueuedEventto theExceptionHandlerby virtue of implementingSystemEventListener.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static StringIN_AFTER_PHASE_KEYThe 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 StringIN_BEFORE_PHASE_KEYThe 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
Constructors Constructor Description ExceptionQueuedEventContext(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<Object,Object>getAttributes()AMapof attributes relevant to the context of thisExceptionQueuedEvent.UIComponentgetComponent()Return theUIComponentwhich was being processed when the exception was thrown.FacesContextgetContext()TheFacesContextfor this request.ThrowablegetException()Return theexceptionproperty.List<SystemEventListener>getListenersForEventClass(Class<? extends SystemEvent> facesEventClass)Return aListthat contains a single entry, theExceptionHandlerfor the current request.PhaseIdgetPhaseId()Return thePhaseIdwhich was being processed when the exception was thrown.booleaninAfterPhase()booleaninBeforePhase()
-
-
-
Field Detail
-
IN_BEFORE_PHASE_KEY
public static final String 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
public static final String 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 Detail
-
ExceptionQueuedEventContext
public ExceptionQueuedEventContext(FacesContext context, Throwable thrown)
Instantiate a new
ExceptionQueuedEventContextthat indicates the argumentThrowablejust occurred.- Parameters:
context-FacesContextfor the current requestthrown- theThrowablethat is the context for thisExceptionQueuedEventContextinstance.
-
ExceptionQueuedEventContext
public ExceptionQueuedEventContext(FacesContext context, Throwable thrown, UIComponent component)
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 Detail
-
getContext
public FacesContext getContext()
The
FacesContextfor this request.- Returns:
- the
FacesContextused to create thisExceptionQueuedEventContextinstance.
-
getException
public Throwable getException()
Return the
exceptionproperty.- Returns:
- the exception
-
getComponent
public UIComponent getComponent()
Return the
UIComponentwhich was being processed when the exception was thrown. If none or not available, this will benull.- Returns:
- the component
-
getPhaseId
public PhaseId 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
public Map<Object,Object> 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
-
-