Class Lifecycle
- java.lang.Object
- 
- jakarta.faces.lifecycle.Lifecycle
 
- 
- Direct Known Subclasses:
- LifecycleWrapper
 
 public abstract class Lifecycle extends Object Lifecycle manages the processing of the entire lifecycle of a particular Jakarta Faces request. It is responsible for executing all of the phases that have been defined by the Jakarta Faces Specification, in the specified order, unless otherwise directed by activities that occurred during the execution of each phase. An instance of Lifecycleis created by calling thegetLifecycle()method ofLifecycleFactory, for a specified lifecycle identifier. Because this instance is shared across multiple simultaneous requests, it must be implemented in a thread-safe manner.
- 
- 
Constructor SummaryConstructors Constructor Description Lifecycle()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddPhaseListener(PhaseListener listener)Register a newPhaseListenerinstance that is interested in being notified before and after the processing for standard phases of the request processing lifecycle.voidattachWindow(FacesContext context)Create or restore theClientWindowto be used to display theUIViewRootfor this run through the lifecycle.abstract voidexecute(FacesContext context)Execute all of the phases of the request processing lifecycle, up to but not including the Render Response phase, as described in section 2 "Request Processing Lifecycle" of the Jakarta Faces Specification Document, in the specified order.abstract PhaseListener[]getPhaseListeners()Return the set of registeredPhaseListeners for thisLifecycleinstance.abstract voidremovePhaseListener(PhaseListener listener)Deregister an existingPhaseListenerinstance that is no longer interested in being notified before and after the processing for standard phases of the request processing lifecycle.abstract voidrender(FacesContext context)Execute the Render Response phase of the request processing lifecycle, unless theresponseComplete()method has been called on theFacesContextinstance associated with the current request.
 
- 
- 
- 
Method Detail- 
addPhaseListenerpublic abstract void addPhaseListener(PhaseListener listener) Register a new PhaseListenerinstance that is interested in being notified before and after the processing for standard phases of the request processing lifecycle.- Parameters:
- listener- The- PhaseListenerto be registered
- Throws:
- NullPointerException- if- listeneris- null
 
 - 
executepublic abstract void execute(FacesContext context) throws FacesException Execute all of the phases of the request processing lifecycle, up to but not including the Render Response phase, as described in section 2 "Request Processing Lifecycle" of the Jakarta Faces Specification Document, in the specified order. The processing flow can be affected (by the application, by components, or by event listeners) by calls to the renderResponse()orresponseComplete()methods of theFacesContextinstance associated with the current request.- Parameters:
- context- FacesContext for the request to be processed
- Throws:
- FacesException- if thrown during the execution of the request processing lifecycle
- NullPointerException- if- contextis- null
 
 - 
attachWindowpublic void attachWindow(FacesContext context) Create or restore the ClientWindowto be used to display theUIViewRootfor this run through the lifecycle. See the class documentation forClientWindowfor an overview of the feature. IfExternalContext.getClientWindow()returns null, create a new instance ofClientWindowusing theClientWindowFactory. If the result is non-null, callClientWindow.decode(jakarta.faces.context.FacesContext)on it. Store the newClientWindowby callingExternalContext.setClientWindow(jakarta.faces.lifecycle.ClientWindow).- Parameters:
- context- the- FacesContextfor this request.
- Since:
- 2.2
 
 - 
getPhaseListenerspublic abstract PhaseListener[] getPhaseListeners() Return the set of registered PhaseListeners for thisLifecycleinstance. If there are no registered listeners, a zero-length array is returned.- Returns:
- the set of registered PhaseListeners
 
 - 
removePhaseListenerpublic abstract void removePhaseListener(PhaseListener listener) Deregister an existing PhaseListenerinstance that is no longer interested in being notified before and after the processing for standard phases of the request processing lifecycle. If no such listener instance has been registered, no action is taken.- Parameters:
- listener- The- PhaseListenerto be deregistered
- Throws:
- NullPointerException- if- listeneris- null
 
 - 
renderpublic abstract void render(FacesContext context) throws FacesException Execute the Render Response phase of the request processing lifecycle, unless the responseComplete()method has been called on theFacesContextinstance associated with the current request.- Parameters:
- context- FacesContext for the request being processed
- Throws:
- FacesException- if an exception is thrown during the execution of the request processing lifecycle
- NullPointerException- if- contextis- null
 
 
- 
 
-