javax.portlet.faces
Interface Bridge


public interface Bridge

The Bridge interface is used by a portlet to execute a JSF artifact. Its lifecycle follows the pattern used by other web components such as portlets or servlets, namely:

Portlet developers are encouraged to allow deployers an ability to configure the particular Bridge implementation it uses within a given deployment. This ensures a best fit solution for a given application server, portlet container, and/or Faces environment. The specifics for this configuation are undefined. Each portlet can define a preferred mechanism. Subclasses of GenericFacesPortlet automatically inherit this behavior as it recognizes a defined portlet initialization parameter.

Implementations of this Bridge interface are required to have a code constructor.


Nested Class Summary
static class Bridge.BridgeRenderPolicy
          Enumeration whose values describe the render policy used by the bridge to render portlets in this application.
static class Bridge.PortletPhase
          Enumeration whose values describe the current portlet phase the bridge is executing Faces within.
 
Field Summary
static java.lang.String AFTER_VIEW_CONTENT
          A PortletRequest attribute set by an include filter in recognition of the RenderContentAfterView bridge attribute.
static java.lang.String BACK_LINK
          Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that an URL refering back to the page which contains this portlet should be encoded in the resource url.
static java.lang.String BRIDGE_EVENT_HANDLER
          A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to use/call the associated eventHandler when processing an event.
static java.lang.String BRIDGE_PACKAGE_PREFIX
           
static java.lang.String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER
          A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to use/call the associated publicRenderParameterHandler.
static java.lang.String DEFAULT_RENDERKIT_ID
          A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to default the renderKitId used for rendering this portlet to the named Id.
static java.lang.String DEFAULT_VIEWID_MAP
          PortletContext attribute that a portlet must set prior to calling the bridge's init() method to convey to the bridge the set of default viewIds that correspond to this portlet's supported PortletModes.
static java.lang.String DIRECT_LINK
          Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should be treated as a direct link and hence shouldn't be encoded as a Portlet action.
static java.lang.String EXCLUDED_REQUEST_ATTRIBUTES
          A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to exclude specific attributes from its bridge request scope.
static java.lang.String FACES_USE_CURRENT_VIEW_PARAMETER
          Special value recognized during encodeActionURL of a portlet: url containing either the _jsfBridgeViewId or _jsfBridgeViewPath parameter.
static java.lang.String FACES_VIEW_ID_PARAMETER
          Name of a request parameter (generally) encoded in a link from a nonFaces view response.
static java.lang.String FACES_VIEW_PATH_PARAMETER
          Name of a request parameter (generally) encoded in a link from a nonFaces view response.
static java.lang.String IN_PROTOCOL_RESOURCE_LINK
          Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that this resource should be handled in protocol.
static java.lang.String IS_POSTBACK_ATTRIBUTE
          A PortletRequest attribute set by the bridge when processing a Faces request that signals this request is a Faces postback.
static java.lang.String LIFECYCLE_ID
          Context initialization parameter that defines the lifecycle ID used to identify the Faces Lifecycle used for this application.
static java.lang.String MAX_MANAGED_REQUEST_SCOPES
          Context initialization parameter that specifies the maximum number of bridge request scopes to preserved across all uses within this application.
static java.lang.String NONFACES_TARGET_PATH_PARAMETER
          Name of the render parameter set by the bridge when it encodes a navigation link to a nonFaces target.
static java.lang.String PORTLET_LIFECYCLE_PHASE
          PortletRequest attribute set by the bridge prior to creating/acquiring a FacesContext.
static java.lang.String PORTLET_MODE_PARAMETER
          Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a PortletMode change to the one indicated by the parameter's value.
static java.lang.String PORTLET_NAMESPACED_RESPONSE_PROPERTY
          Name of PortletResponse property set by the bridge when it recognizes that the view has been rendered using a NamingContainer that ensures all generated ids are namespaced using the consumer provided unique portlet id.
static java.lang.String PORTLET_SECURE_PARAMETER
          Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a security level change to the one indicated by the parameter's value.
static java.lang.String PORTLET_WINDOWSTATE_PARAMETER
          Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a WindowState change to the one indicated by the parameter's value.
static java.lang.String PRESERVE_ACTION_PARAMS
          A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to preserve action parameters received by this portlet along with bridge's request scope so that they may be restored and acessed in subsequent renders.
static java.lang.String RENDER_CONTENT_AFTER_VIEW
          A PortletRequest attribute set by the bridge in its ViewHandler.renderView prior to dispatching the request to the view (jsp)to indicating a filter should put the AFTER_VIEW_CONTENT in a buffer on the request for it to process after rendering the view components.
static java.lang.String RENDER_POLICY
          Context initialization parameter that defines the policy the bridge uses for rendering.
static java.lang.String SAVESTATE_FIELD_MARKER
          Context initialization parameter that defines the SAVESTATE_FIELD_MARKER in use in the given deployment.
static java.lang.String VIEW_ID
          PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method.
static java.lang.String VIEW_LINK
          Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that this url refers to Faces view (navigation) and hence should be encoded as an portlet ActionURL rather then a portlet resource url.
static java.lang.String VIEW_PATH
          PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method.
static java.lang.String VIEWID_HISTORY
          PortletSession attribute set by the bridge to hold the last viewId accessed in a given mode.
 
Method Summary
 void destroy()
          Called by the portlet to take the bridge out of service.
 void doFacesRequest(ActionRequest request, ActionResponse response)
          Called by the portlet when it wants the bridge to process an action request.
 void doFacesRequest(EventRequest request, EventResponse response)
          Called by the portlet when it wants the bridge to process an event request.
 void doFacesRequest(RenderRequest request, RenderResponse response)
          Called by the portlet when it wants the bridge to process a render request.
 void doFacesRequest(ResourceRequest request, ResourceResponse response)
          Called by the portlet when it wants the bridge to process an in-protocol resource request.
 void init(PortletConfig config)
          Called by the portlet.
 

Field Detail

BRIDGE_PACKAGE_PREFIX

static final java.lang.String BRIDGE_PACKAGE_PREFIX
See Also:
Constant Field Values

MAX_MANAGED_REQUEST_SCOPES

static final java.lang.String MAX_MANAGED_REQUEST_SCOPES
Context initialization parameter that specifies the maximum number of bridge request scopes to preserved across all uses within this application.

See Also:
Constant Field Values

RENDER_POLICY

static final java.lang.String RENDER_POLICY
Context initialization parameter that defines the policy the bridge uses for rendering. Parameter value is the string representaiton of one of the BridgeRenderPolicy enum values.

See Also:
Constant Field Values

LIFECYCLE_ID

static final java.lang.String LIFECYCLE_ID
Context initialization parameter that defines the lifecycle ID used to identify the Faces Lifecycle used for this application.

See Also:
Constant Field Values

SAVESTATE_FIELD_MARKER

static final java.lang.String SAVESTATE_FIELD_MARKER
Context initialization parameter that defines the SAVESTATE_FIELD_MARKER in use in the given deployment. If not set, consult your bridge implementation documentation to determine which Faces implementations it automatically detects and supports. For example the bridge RI will detect and run properly in either the Faces RI or MyFaces environments without this being set.

See Also:
Constant Field Values

EXCLUDED_REQUEST_ATTRIBUTES

static final java.lang.String EXCLUDED_REQUEST_ATTRIBUTES
A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to exclude specific attributes from its bridge request scope. Value is a comma delimited list containing either a fully qualified attribute name or package name terminated with a ".*" wildcard indicator. In this later case, all attributes in the package name which precedes the ".*" are excluded, non recursive.
As this attribute is scoped to a specific portlet in an application-wide context the attribute name must be include the portlet name as follows: BRIDGE_PACKAGE_PREFIX + context.getPortletName() + excludedRequestAttributes

See Also:
Constant Field Values

DEFAULT_VIEWID_MAP

static final java.lang.String DEFAULT_VIEWID_MAP
PortletContext attribute that a portlet must set prior to calling the bridge's init() method to convey to the bridge the set of default viewIds that correspond to this portlet's supported PortletModes. Its value is a Map with one entry per mode. The mode name is the key. The entry's value is the corresponding default viewId the bridge should use for this mode.
As this attribute is scoped to a specific portlet in an application-wide context the attribute name must be include the portlet name as follows: BRIDGE_PACKAGE_PREFIX + context.getPortletName() + DEFAULT_VIEWID_MAP

See Also:
Constant Field Values

PRESERVE_ACTION_PARAMS

static final java.lang.String PRESERVE_ACTION_PARAMS
A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to preserve action parameters received by this portlet along with bridge's request scope so that they may be restored and acessed in subsequent renders. If "true", the action parameters are preserved. If "false", they are not preserved. The bridge default is "false".
As this attribute is scoped to a specific portlet in an application-wide context the attribute name must be include the portlet name as follows: BRIDGE_PACKAGE_PREFIX + context.getPortletName() + preserveActionParams

See Also:
Constant Field Values

BRIDGE_EVENT_HANDLER

static final java.lang.String BRIDGE_EVENT_HANDLER
A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to use/call the associated eventHandler when processing an event. Value is an instance of BridgeEventHandler. As this attribute is scoped to a specific portlet in an application-wide context the attribute name must be include the portlet name as follows: BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler

See Also:
Constant Field Values

BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER

static final java.lang.String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER
A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to use/call the associated publicRenderParameterHandler. This handler is used to process updates that result from public render parameter changes passed in a request. The bridge first pushs all the public render parameter values into the models and then calls this handler's processUpdates method. The handler can then compute further model changes based on the changes. Value is an instance of BridgePublicRenderParameterHandler. As this attribute is scoped to a specific portlet in an application-wide context the attribute name must be include the portlet name as follows: BRIDGE_PACKAGE_PREFIX + context.getPortletName() + bridgeEventHandler

See Also:
Constant Field Values

DEFAULT_RENDERKIT_ID

static final java.lang.String DEFAULT_RENDERKIT_ID
A PortletContext attribute that a portlet can set prior to calling the bridge's init() method to configure the bridge to default the renderKitId used for rendering this portlet to the named Id. In Faces, the default renderKitId is set in the faces-config.xml and is application wide. In 1.2 this can be overidden by a specially named request parameter. To allow differing portlets in the same app to use different default render kits, without having to add this parameter, the portlet can set this attribute prior to the bridge init(). The bridge will recognize this configuration value and on each request add the special faces request parameter to the request (if its not already present).

See Also:
Constant Field Values

VIEW_ID

static final java.lang.String VIEW_ID
PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method. The value of this attribute is a String representing the Faces viewId the bridge is to target for this request. Used by a portlet to specifically control a request's view target in situations such as navigating from a nonFaces view to a specific Faces view (other than the default).

Generally, the use of this attribute is mutually exclusive with the use of VIEW_PATH. If both have been set in a given request, the bridge gives precedence to VIEW_ID.

See Also:
Constant Field Values

VIEW_PATH

static final java.lang.String VIEW_PATH
PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method. The value of this attribute is a String containing a ContextPath relative path in which the Faces viewId is encoded. Like VIEW_ID, this attribute provides a means for a portlet to explicitly control the Faces target for a specific request. It is used in situations such as navigating from a nonFaces view to a specific Faces view (other than the default).

Generally, the use of this attribute is mutually exclusive with the use of VIEW_PATH. If both have been set in a given request, the bridge gives precedence to VIEW_ID.

See Also:
Constant Field Values

PORTLET_MODE_PARAMETER

static final java.lang.String PORTLET_MODE_PARAMETER
Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a PortletMode change to the one indicated by the parameter's value.

See Also:
Constant Field Values

PORTLET_WINDOWSTATE_PARAMETER

static final java.lang.String PORTLET_WINDOWSTATE_PARAMETER
Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a WindowState change to the one indicated by the parameter's value.

See Also:
Constant Field Values

PORTLET_SECURE_PARAMETER

static final java.lang.String PORTLET_SECURE_PARAMETER
Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should encode a security level change to the one indicated by the parameter's value.

See Also:
Constant Field Values

DIRECT_LINK

static final java.lang.String DIRECT_LINK
Special token parameter in the url passed to the bridge's ExternalContext.encodeActionURL() that it recognizes as an indication that this action should be treated as a direct link and hence shouldn't be encoded as a Portlet action. Rather encodeActionURL merely returns this url unchanged.

See Also:
Constant Field Values

IN_PROTOCOL_RESOURCE_LINK

static final java.lang.String IN_PROTOCOL_RESOURCE_LINK
Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that this resource should be handled in protocol.

See Also:
Constant Field Values

BACK_LINK

static final java.lang.String BACK_LINK
Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that an URL refering back to the page which contains this portlet should be encoded in the resource url. This reference is encoded as the value of a query string parameter whose name is the value of this back link token parameter.

See Also:
Constant Field Values

VIEW_LINK

static final java.lang.String VIEW_LINK
Special token parameter in the url passed to the bridge's ExternalContext.encodeResourceURL() that it recognizes as an indication that this url refers to Faces view (navigation) and hence should be encoded as an portlet ActionURL rather then a portlet resource url. This token is intended for use in urls signifying a view navigation using components such as h:outputLink.

See Also:
Constant Field Values

IS_POSTBACK_ATTRIBUTE

static final java.lang.String IS_POSTBACK_ATTRIBUTE
A PortletRequest attribute set by the bridge when processing a Faces request that signals this request is a Faces postback. Its provided as an alternative signal to the common reliance on the view state parameter as an indicator that this is a postback request. Implementations needing this information and not using the view state parameter indicator can check this attribute when running in a portlet environment.

See Also:
Constant Field Values

RENDER_CONTENT_AFTER_VIEW

static final java.lang.String RENDER_CONTENT_AFTER_VIEW
A PortletRequest attribute set by the bridge in its ViewHandler.renderView prior to dispatching the request to the view (jsp)to indicating a filter should put the AFTER_VIEW_CONTENT in a buffer on the request for it to process after rendering the view components. In conjunction with the filter this enables preserving rendering order of native JSP rendering and Faces rendering in a jsp.

See Also:
Constant Field Values

AFTER_VIEW_CONTENT

static final java.lang.String AFTER_VIEW_CONTENT
A PortletRequest attribute set by an include filter in recognition of the RenderContentAfterView bridge attribute. Its value is either char[] or byte[] holding the AFTER_VIEW_CONTENT generated while rendering this jsp. In conjunction with the bridge this enables preserving rendering order of native JSP rendering and Faces rendering in a jsp.

See Also:
Constant Field Values

PORTLET_LIFECYCLE_PHASE

static final java.lang.String PORTLET_LIFECYCLE_PHASE
PortletRequest attribute set by the bridge prior to creating/acquiring a FacesContext. Its value indicates which portlet phase this Faces is executing in. It can be used by Faces subsystems not only to determine the portlet exectution phase but if present (not null) as an indication the request is being processed in a portlet container.

See Also:
Constant Field Values

VIEWID_HISTORY

static final java.lang.String VIEWID_HISTORY
PortletSession attribute set by the bridge to hold the last viewId accessed in a given mode. The attribute (key) is composed of this name + the mode name. I.e. javax.portlet.faces.viewIdHistory.view. There is one attribute per supported portlet mode. The attributes are always set even if the user session has never entered the mode. Its initial setting/value is determined by the default viewId configured for the mode. Attribute is used by developers to reference/return to the last view in a given Mode from another mode.

See Also:
Constant Field Values

PORTLET_NAMESPACED_RESPONSE_PROPERTY

static final java.lang.String PORTLET_NAMESPACED_RESPONSE_PROPERTY
Name of PortletResponse property set by the bridge when it recognizes that the view has been rendered using a NamingContainer that ensures all generated ids are namespaced using the consumer provided unique portlet id.

See Also:
Constant Field Values

NONFACES_TARGET_PATH_PARAMETER

static final java.lang.String NONFACES_TARGET_PATH_PARAMETER
Name of the render parameter set by the bridge when it encodes a navigation link to a nonFaces target. Though the bridge recognizes nonFaces targets when it encodes a navigational link, it does not handle the subsequent request. It only handles requests for Faces targets. It is the portlet's responsibility to detect and handle these requests. When the nonFaces target is a path based resource (such as a jsp or servlet), the ContextPath relative path of the resource is written as the value of this render parameter. For convenience, the GenericFacesPortlet recognizes this render parameter in received requests and uses the PortletRequestDispatcher to dispatch to the encoded path instead of calling the bridge to execute the request.

See Also:
Constant Field Values

FACES_VIEW_ID_PARAMETER

static final java.lang.String FACES_VIEW_ID_PARAMETER
Name of a request parameter (generally) encoded in a link from a nonFaces view response. It acts as a marker to the portlet that the nonFaces view intends to navigate to the Faces view expressed in the value of this parameter. It differs from the FACES_VIEW_PATH_PARAMETER in that its value is the actual Faces viewId of the target while the formaer is a ContextPath relative path containing the viewId.

Portlets receiving such a parameter should set the the corresponding request attribute javax.portlet.faces.viewId before calling the bridge to handle the request.

See Also:
Constant Field Values

FACES_VIEW_PATH_PARAMETER

static final java.lang.String FACES_VIEW_PATH_PARAMETER
Name of a request parameter (generally) encoded in a link from a nonFaces view response. It acts as a marker to the portlet that the nonFaces view intends to navigate to the Faces view expressed in the value of this parameter. It differs from the FACES_VIEW_ID_PARAMETER in that its value is a ContextPath relative path containing the viewId while the former is the viewId itself.

Portlets receiving such a parameter should set the the corresponding request attribute javax.portlet.faces.viewPath before calling the bridge to handle the request.

See Also:
Constant Field Values

FACES_USE_CURRENT_VIEW_PARAMETER

static final java.lang.String FACES_USE_CURRENT_VIEW_PARAMETER
Special value recognized during encodeActionURL of a portlet: url containing either the _jsfBridgeViewId or _jsfBridgeViewPath parameter. encodeActionURL recognizes this value as indicating it needs to generate and encode an URL to the current JSF including its current state. I.e. It not only encodes the link reference but also the existing render parameters so they can be carried forward to reestablish the state.

See Also:
Constant Field Values
Method Detail

init

void init(PortletConfig config)
          throws BridgeException
Called by the portlet. It indicates that the bridge is being placed into service.

The portlet calls the init method exactly once before invoking other lifecycle methods. Usually, done immediately after instantiating the bridge. The init method must complete successfully before the bridge can receive any requests.

The portlet cannot place the bridge into service if the init method Throws a BridgeException.

Initialization context is passed to bridge via PortletContext attributes. The following attributes are defined:

Parameters:
config - a PortletConfig object containing the portlet's configuration and initialization parameters
Throws:
BridgeException - if an exception has occurred that interferes with the bridge's normal operation. For example, if the bridge is already initialized.
UnavailableException - if the portlet cannot perform the initialization at this time.

doFacesRequest

void doFacesRequest(ActionRequest request,
                    ActionResponse response)
                    throws BridgeDefaultViewNotSpecifiedException,
                           BridgeUninitializedException,
                           BridgeException
Called by the portlet when it wants the bridge to process an action request.

Parameters:
request - the request object.
response - the response object.
Throws:
BridgeDefaultViewNotSpecifiedException - thrown if the request indicates to the Bridge that is should use the default ViewId and the portlet hasn't supplied one.
BridgeUninitializedException - thrown if the bridge is not initialized.
BridgeException - all other internal exceptions are converted to a BridgeException.

doFacesRequest

void doFacesRequest(EventRequest request,
                    EventResponse response)
                    throws BridgeUninitializedException,
                           BridgeException
Called by the portlet when it wants the bridge to process an event request.

Parameters:
request - the request object.
response - the response object.
Throws:
BridgeUninitializedException - thrown if the bridge is not initialized.
BridgeException - all other internal exceptions are converted to a BridgeException.

doFacesRequest

void doFacesRequest(RenderRequest request,
                    RenderResponse response)
                    throws BridgeDefaultViewNotSpecifiedException,
                           BridgeUninitializedException,
                           BridgeException
Called by the portlet when it wants the bridge to process a render request.

Parameters:
request - the request object.
response - the response object.
Throws:
BridgeDefaultViewNotSpecifiedException - thrown if the request indicates to the Bridge that is should use the default ViewId and the portlet hasn't supplied one.
BridgeUninitializedException - thrown if the bridge is not initialized.
BridgeException - all other internal exceptions are converted to a BridgeException.

doFacesRequest

void doFacesRequest(ResourceRequest request,
                    ResourceResponse response)
                    throws BridgeUninitializedException,
                           BridgeException
Called by the portlet when it wants the bridge to process an in-protocol resource request.

Parameters:
request - the request object.
response - the response object.
Throws:
BridgeUninitializedException - thrown if the bridge is not initialized.
BridgeException - all other internal exceptions are converted to a BridgeException.

destroy

void destroy()
Called by the portlet to take the bridge out of service. Once out of service, the bridge must be reinitialized before processing any further requests.



Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.