Top Description Fields Constructors Methods
javax.faces.lifecycle

public abstract Class ClientWindow

extends Object
Class Inheritance
Known Direct Subclasses
javax.faces.lifecycle.ClientWindowWrapper, com.sun.faces.lifecycle.ClientWindowImpl
Imports
java.util.Map, javax.faces.context.FacesContext, javax.faces.render.ResponseStateManager

This class represents a client window, which may be a browser tab, browser window, browser pop-up, portlet, or anything else that can display a javax.faces.component.UIComponent hierarchy rooted at a javax.faces.component.UIViewRoot.

Modes of Operation

none mode

The generation of ClientWindow is controlled by the value of the context-param named by the value of CLIENT_WINDOW_MODE_PARAM_NAME. If this context-param is not specified, or its value is "none", no ClientWindow instances will be generated, and the entire feature is effectively disabled for the entire application.

Other modes

To accomadate the widest possible range of implementation choices to support this feature, explicit names for modes other than "none" and "url" are not specified. However, for all values of CLIENT_WINDOW_MODE_PARAM_NAME, the lifetime of a ClientWindow starts on the first request made by a particular client window (or tab, or pop-up, etc) to the JSF runtime and persists as long as that window remains open or the session expires, whichever comes first. A client window is always associated with exactly one UIViewRoot instance at a time, but may display many different UIViewRoots during its lifetime.

The ClientWindow instance is associated with the incoming request during the Lifecycle#attachWindow method. This method will cause a new instance of ClientWindow to be created, assigned an id, and passed to javax.faces.context.ExternalContext#setClientWindow.

During state saving, regardless of the window id mode, or state saving mode, for ajax and non-ajax requests, a hidden field must be written whose name, id and value are given as specified in javax.faces.render.ResponseStateManager#CLIENT_WINDOW_PARAM.

In addition to the hidden field already described. The runtime must ensure that any component that renders a hyperlink that causes the user agent to send a GET request to the Faces server when it is clicked has a query parameter with a name and value specified in ResponseStateManager#CLIENT_WINDOW_URL_PARAM. This requirement is met by several of the "encode" methods on javax.faces.context.ExternalContext. See javax.faces.context.ExternalContext#encodeActionURL(java.lang.String) for details.

Since
2.2

Field Summary

Modifier and TypeField and Description
public static final String
CLIENT_WINDOW_MODE_PARAM_NAME

The context-param that controls the operation of the ClientWindow feature.

private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract void
decode(FacesContext
the FacesContext for this request.
context
)

The implementation is responsible for examining the incoming request and extracting the value that must be returned from the getId method.

public void
disableClientWindowRenderMode(FacesContext
the FacesContext for this request.
context
)

Components that permit per-use disabling of the appending of the ClientWindow in generated URLs must call this method first before rendering those URLs.

public void
enableClientWindowRenderMode(FacesContext
the FacesContext for this request.
context
)

Components that permit per-use disabling of the appending of the ClientWindow in generated URLs must call this method first after rendering those URLs.

public abstract String

Returns:

the id of the ClientWindow
getId
()

Return a String value that uniquely identifies this ClientWindow within the scope of the current session.

public abstract Map<String, String>

Returns:

null or a map of parameters to insert into the URL query string.
getQueryURLParameters
(FacesContext
the FacesContext for this request.
context
)

This method will be called whenever a URL is generated by the runtime where client window related parameters need to be inserted into the URL.

public boolean

Returns:

the result as specified above
isClientWindowRenderModeEnabled
(FacesContext
the FacesContext for this request.
context
)

Methods that append the ClientWindow to generated URLs must call this method to see if they are permitted to do so.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLIENT_WINDOW_MODE_PARAM_NAMEback to summary
public static final String CLIENT_WINDOW_MODE_PARAM_NAME

The context-param that controls the operation of the ClientWindow feature. The runtime must support the values "none" and "url", without the quotes, but other values are possible. If not specified, or the value is not understood by the implementation, "none" is assumed.

Since
2.2
PER_USE_CLIENT_WINDOW_URL_QUERY_PARAMETER_DISABLED_KEYback to summary
private static final String PER_USE_CLIENT_WINDOW_URL_QUERY_PARAMETER_DISABLED_KEY

Constructor Detail

ClientWindowback to summary
public ClientWindow()

Method Detail

decodeback to summary
public abstract void decode(FacesContext context)

The implementation is responsible for examining the incoming request and extracting the value that must be returned from the getId method. If CLIENT_WINDOW_MODE_PARAM_NAME is "none" this method must not be invoked. If CLIENT_WINDOW_MODE_PARAM_NAME is "url" the implementation must first look for a request parameter under the name given by the value of javax.faces.render.ResponseStateManager#CLIENT_WINDOW_PARAM. If no value is found, look for a request parameter under the name given by the value of javax.faces.render.ResponseStateManager#CLIENT_WINDOW_URL_PARAM. If no value is found, fabricate an id that uniquely identifies this ClientWindow within the scope of the current session. This value must be made available to return from the getId method. The value must be suitable for inclusion as a hidden field or query parameter. If a value is found, decrypt it using the key from the session and make it available for return from getId.

Parameters
context:FacesContext

the FacesContext for this request.

Since
2.2
disableClientWindowRenderModeback to summary
public void disableClientWindowRenderMode(FacesContext context)

Components that permit per-use disabling of the appending of the ClientWindow in generated URLs must call this method first before rendering those URLs. The caller must call enableClientWindowRenderMode(javax.faces.context.FacesContext) from a finally block after rendering the URL. If CLIENT_WINDOW_MODE_PARAM_NAME is "url" without the quotes, all generated URLs that cause a GET request must append the ClientWindow by default. This is specified as a static method because callsites need to access it without having access to an actual ClientWindow instance.

Parameters
context:FacesContext

the FacesContext for this request.

Since
2.2
enableClientWindowRenderModeback to summary
public void enableClientWindowRenderMode(FacesContext context)

Components that permit per-use disabling of the appending of the ClientWindow in generated URLs must call this method first after rendering those URLs. If CLIENT_WINDOW_MODE_PARAM_NAME is "url" without the quotes, all generated URLs that cause a GET request must append the ClientWindow by default. This is specified as a static method because callsites need to access it without having access to an actual ClientWindow instance.

Parameters
context:FacesContext

the FacesContext for this request.

Since
2.2
getIdback to summary
public abstract String getId()

Return a String value that uniquely identifies this ClientWindow within the scope of the current session. See decode for the specification of how to derive this value.

Returns:String

the id of the ClientWindow

Since
2.2
getQueryURLParametersback to summary
public abstract Map<String, String> getQueryURLParameters(FacesContext context)

This method will be called whenever a URL is generated by the runtime where client window related parameters need to be inserted into the URL. This guarantees custom ClientWindow implementations that they will have the opportunity to insert any additional client window specific information in any case where a URL is generated, such as the rendering of hyperlinks. The returned map must be immutable. The default implementation of this method returns the empty map.

Parameters
context:FacesContext

the FacesContext for this request.

Returns:Map<String, String>

null or a map of parameters to insert into the URL query string.

Since
2.2
isClientWindowRenderModeEnabledback to summary
public boolean isClientWindowRenderModeEnabled(FacesContext context)

Methods that append the ClientWindow to generated URLs must call this method to see if they are permitted to do so. If CLIENT_WINDOW_MODE_PARAM_NAME is "url" without the quotes, all generated URLs that cause a GET request must append the ClientWindow by default. This is specified as a static method because callsites need to access it without having access to an actual ClientWindow instance.

Parameters
context:FacesContext

the FacesContext for this request.

Returns:boolean

the result as specified above

Since
2.2