|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.faces.application Class ViewHandler
java.lang.Objectjavax.faces.application.ViewHandler
- 直接已知子类:
- ViewHandlerWrapper
public abstract class ViewHandler
- extends Object
ViewHandler is the pluggablity mechanism for allowing implementations of or applications using the JavaServer Faces specification to provide their own handling of the activities in the Render Response and Restore View phases of the request processing lifecycle. This allows for implementations to support different response generation technologies, as well as alternative strategies for saving and restoring the state of each view.
Please see StateManager for information on how the
ViewHandler interacts the StateManager.
| 字段摘要 | |
|---|---|
static String |
CHARACTER_ENCODING_KEY
The key, in the session's attribute set, under which the response character encoding may be stored and retrieved. |
static String |
DEFAULT_SUFFIX
The value to use for the default extension if the webapp is using url extension mapping. |
static String |
DEFAULT_SUFFIX_PARAM_NAME
Allow the web application to define an alternate suffix for pages containing JSF content. |
| 构造器摘要 | |
|---|---|
ViewHandler()
|
|
| 方法摘要 | |
|---|---|
String |
calculateCharacterEncoding(FacesContext context)
Returns the correct character encoding to be used for this request. |
abstract Locale |
calculateLocale(FacesContext context)
Returns an appropriate Locale to use for this and
subsequent requests for the current client. |
abstract String |
calculateRenderKitId(FacesContext context)
Return an appropriate renderKitId for this and
subsequent requests from the current client. |
abstract UIViewRoot |
createView(FacesContext context,
String viewId)
Create and return a new UIViewRoot instance
initialized with information from the argument
FacesContext and viewId. |
abstract String |
getActionURL(FacesContext context,
String viewId)
Return a URL suitable for rendering (after optional encoding performed by the encodeActionURL() method of
ExternalContext) that selects the specified view identifier. |
abstract String |
getResourceURL(FacesContext context,
String path)
Return a URL suitable for rendering (after optional encoding perfomed by the encodeResourceURL() method of
ExternalContext) that selects the specifed web application
resource. |
void |
initView(FacesContext context)
Initialize the view for the request processing lifecycle. |
abstract void |
renderView(FacesContext context,
UIViewRoot viewToRender)
Perform whatever actions are required to render the response view to the response object associated with the current FacesContext. |
abstract UIViewRoot |
restoreView(FacesContext context,
String viewId)
Perform whatever actions are required to restore the view associated with the specified FacesContext and
viewId. |
abstract void |
writeState(FacesContext context)
Take any appropriate action to either immediately write out the current state information (by calling StateManager.writeState(javax.faces.context.FacesContext, java.lang.Object), or noting where state information
should later be written. |
| 类方法继承 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
CHARACTER_ENCODING_KEY
public static final String CHARACTER_ENCODING_KEY
The key, in the session's attribute set, under which the response character encoding may be stored and retrieved.
- 另请参见:
- 常量字段
DEFAULT_SUFFIX_PARAM_NAME
public static final String DEFAULT_SUFFIX_PARAM_NAME
Allow the web application to define an alternate suffix for pages containing JSF content. If this init parameter is not specified, the default value is taken from the value of the constant
DEFAULT_SUFFIX.- 另请参见:
- 常量字段
DEFAULT_SUFFIX
public static final String DEFAULT_SUFFIX
The value to use for the default extension if the webapp is using url extension mapping.
- 另请参见:
- 常量字段
| 构造器详细信息 |
|---|
ViewHandler
public ViewHandler()
| 方法详细信息 |
|---|
calculateLocale
public abstract Locale calculateLocale(FacesContext context)
Returns an appropriate
Localeto use for this and subsequent requests for the current client.- 参数:
context-FacesContextfor the current request- 抛出异常:
NullPointerException- ifcontextisnull
calculateCharacterEncoding
public String calculateCharacterEncoding(FacesContext context)
Returns the correct character encoding to be used for this request.
The following algorithm is employed.
Examine the
Content-Typerequest header. If it has acharsetparameter, extract it and return that as the encoding.If no
charsetparameter was found, check for the existence of a session by callingExternalContext.getSession(boolean)passingfalseas the argument. If that method returnstrue, get the session Map by callingExternalContext.getSessionMap()and look for a value under the key given by the value of the symbolic constantCHARACTER_ENCODING_KEY. If present, return the value, converted to String.Otherwise, return
null
calculateRenderKitId
public abstract String calculateRenderKitId(FacesContext context)
Return an appropriate
renderKitIdfor this and subsequent requests from the current client. It is an error for this method to returnnull.The default return value is
RenderKitFactory.HTML_BASIC_RENDER_KIT.- 参数:
context-FacesContextfor the current request- 抛出异常:
NullPointerException- ifcontextisnull
createView
public abstract UIViewRoot createView(FacesContext context, String viewId)
Create and return a new
UIViewRootinstance initialized with information from the argumentFacesContextandviewId.If there is an existing
ViewRootavailable on theFacesContext, this method must copy itslocaleandrenderKitIdto this new view root. If not, this method must callcalculateLocale(javax.faces.context.FacesContext)andcalculateRenderKitId(javax.faces.context.FacesContext), and store the results as the values of thelocaleandrenderKitId, proeprties, respectively, of the newly createdUIViewRoot.- 抛出异常:
NullPointerException- ifcontextisnull
getActionURL
public abstract String getActionURL(FacesContext context, String viewId)
Return a URL suitable for rendering (after optional encoding performed by the
encodeActionURL()method ofExternalContext) that selects the specified view identifier.- 参数:
context-FacesContextfor this requestviewId- View identifier of the desired view- 抛出异常:
IllegalArgumentException- ifviewIdis not valid for thisViewHandler.NullPointerException- ifcontextorviewIdisnull.
getResourceURL
public abstract String getResourceURL(FacesContext context, String path)
Return a URL suitable for rendering (after optional encoding perfomed by the
encodeResourceURL()method ofExternalContext) that selects the specifed web application resource. If the specified path starts with a slash, it must be treated as context relative; otherwise, it must be treated as relative to the action URL of the current view.- 参数:
context-FacesContextfor the current requestpath- Resource path to convert to a URL- 抛出异常:
IllegalArgumentException- ifviewIdis not valid for thisViewHandler.NullPointerException- ifcontextorpathisnull.
initView
public void initView(FacesContext context) throws FacesException
Initialize the view for the request processing lifecycle.
This method must be called at the beginning of the Restore View Phase of the Request Processing Lifecycle. It is responsible for performing any per-request initialization necessary to the operation of the lifycecle.
The default implementation calls
calculateCharacterEncoding(javax.faces.context.FacesContext)and passes the result, if non-nullinto theExternalContext.setRequestCharacterEncoding(java.lang.String)method.- 抛出异常:
FacesException- if a problem occurs setting the encoding, such as theUnsupportedEncodingExceptionthrown by the underlying Servlet or Portlet technology when the encoding is not supported.
renderView
public abstract void renderView(FacesContext context, UIViewRoot viewToRender) throws IOException, FacesException
Perform whatever actions are required to render the response view to the response object associated with the current
FacesContext.- 参数:
context-FacesContextfor the current requestviewToRender- the view to render- 抛出异常:
IOException- if an input/output error occursNullPointerException- ifcontextorviewToRenderisnullFacesException- if a servlet error occurs
restoreView
public abstract UIViewRoot restoreView(FacesContext context, String viewId)
Perform whatever actions are required to restore the view associated with the specified
FacesContextandviewId. It may delegate to therestoreViewof the associatedStateManagerto do the actual work of restoring the view. If there is no available state for the specifiedviewId, returnnull.- 参数:
context-FacesContextfor the current requestviewId- the view identifier for the current request- 抛出异常:
NullPointerException- ifcontextisnullFacesException- if a servlet error occurs
writeState
public abstract void writeState(FacesContext context) throws IOException
Take any appropriate action to either immediately write out the current state information (by calling
StateManager.writeState(javax.faces.context.FacesContext, java.lang.Object), or noting where state information should later be written.- 参数:
context-FacesContextfor the current request- 抛出异常:
IOException- if an input/output error occursNullPointerException- ifcontextisnull
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.
javax.faces.application.ViewHandler