Lifecycle (Java EE 5)

Java EE API


javax.faces.lifecycle Class Lifecycle

java.lang.Object
  extended by javax.faces.lifecycle.Lifecycle

public abstract class Lifecycle
extends Object


Lifecycle 管理特定 JavaServer Faces 请求的整个生命周期处理过程。它负责以指定的顺序执行 JavaServer Faces 规范中定义的所有阶段,除非在执行各个阶段期间发生的活动指示采用其他顺序。

Lifecycle 的实例可以通过对指定的生命周期标识符调用 LifecycleFactorygetLifecycle() 方法创建。因为此实例由多个同步请求共享,所以它必须以线程安全的方式实现。

英文文档:

Lifecycle manages the processing of the entire lifecycle of a particular JavaServer Faces request. It is responsible for executing all of the phases that have been defined by the JavaServer Faces Specification, in the specified order, unless otherwise directed by activities that occurred during the execution of each phase.

An instance of Lifecycle is created by calling the getLifecycle() method of LifecycleFactory, for a specified lifecycle identifier. Because this instance is shared across multiple simultaneous requests, it must be implemented in a thread-safe manner.


Constructor Summary
 
Method Summary
abstract  void
abstract  void
abstract  PhaseListener[]
abstract  void
abstract  void
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public Lifecycle()
英文文档:

Lifecycle

public Lifecycle()
Method Detail

abstract public void addPhaseListener(PhaseListener listener)

注册新的 PhaseListener 实例,在处理请求处理生命周期的标准阶段之前和之后将通知该实例。

listener 要注册的 PhaseListener
ThrowsNullPointerException: 如果 listenernull
英文文档:

addPhaseListener

public abstract void addPhaseListener(PhaseListener listener)

Register a new PhaseListener instance that is interested in being notified before and after the processing for standard phases of the request processing lifecycle.

Parameters:
listener - The PhaseListener to be registered
Throws:
NullPointerException - if listener is null

abstract public void execute(FacesContext context) throws FacesException

以指定的顺序执行请求处理生命周期的所有阶段,直到但不包括呈现响应 阶段,如 JavaServer Faces 规范中所述。(应用程序、组件或事件侦听器)可以通过调用当前请求关联的 FacesContext 实例的 renderResponse()responseComplete() 方法影响处理流。

context 要处理的请求的 FacesContext
ThrowsFacesException: 如果在执行请求处理生命周期的过程中抛出
ThrowsNullPointerException: 如果 contextnull
英文文档:

execute

public 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 the JavaServer Faces Specification, in the specified order. The processing flow can be affected (by the application, by components, or by event listeners) by calls to the renderResponse() or responseComplete() methods of the FacesContext instance 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 context is null

abstract public PhaseListener[] getPhaseListeners()

返回针对此 Lifecycle 实例注册的 PhaseListener 集。如果不存在任何已注册侦听器,则此方法返回一个长度为 0 的数组。

英文文档:

getPhaseListeners

public abstract PhaseListener[] getPhaseListeners()

Return the set of registered PhaseListeners for this Lifecycle instance. If there are no registered listeners, a zero-length array is returned.


abstract public void removePhaseListener(PhaseListener listener)

取消注册现有的 PhaseListener 实例,在处理请求处理生命周期的标准阶段之前和之后不再通知该实例。如果没有注册任何侦听器实例,则不执行任何操作。

listener 要取消注册的 PhaseListener
ThrowsNullPointerException: 如果 listenernull
英文文档:

removePhaseListener

public abstract void removePhaseListener(PhaseListener listener)

Deregister an existing PhaseListener instance 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 PhaseListener to be deregistered
Throws:
NullPointerException - if listener is null

abstract public void render(FacesContext context) throws FacesException

执行请求处理生命周期的呈现响应 阶段,除非对当前请求关联的 FacesContext 实例调用 responseComplete() 方法。

context 要处理的请求的 FacesContext
ThrowsFacesException: 如果在执行请求处理生命周期的过程中抛出异常
ThrowsNullPointerException: 如果 contextnull
英文文档:

render

public 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 the FacesContext instance 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 context is null


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!