public interface Bridge
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:
init: one time (per portlet) initialization. Usually invoked during portlet init but
may also occur lazily. Context is passed to the Bridge at initialization via PortletContext attributes.
See method description for details.doFacesRequest: called for each portlet request that is to be handled by Faces. Must only be called
after the bridge has been initialized.destroy: called to destroy this bridge instance. Usually invoked during portlet destroy
but may also occur earlier if the portlet decides to reclaim resources.
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.
| Modifier and Type | Interface and Description |
|---|---|
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.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
AFTER_VIEW_CONTENT
A PortletRequest attribute set by an include filter in recognition of the RenderContentAfterView bridge
attribute.
|
static 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 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 String |
BRIDGE_PACKAGE_PREFIX |
static 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 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 String |
DEFAULT_VIEW_ID_ATTR
Request-scope attribute name for the default request viewId .
|
static 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 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 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 String |
EXTENDED_PORTLET_ATTR_PREFIX
Per-portlet extensions attributes prefix ( this implementation-specific ), for additional parameters, as
described in the JSR 301 PLT 3.2
|
static String |
FACES_USE_CURRENT_VIEW_PARAMETER
Special value recognized during
encodeActionURL of a portlet: url containing either the
_jsfBridgeViewId or _jsfBridgeViewPath parameter. |
static String |
FACES_VIEW_ID_PARAMETER
Name of a request parameter (generally) encoded in a link from a nonFaces view response.
|
static String |
FACES_VIEW_PATH_PARAMETER
Name of a request parameter (generally) encoded in a link from a nonFaces view response.
|
static 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 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 String |
LIFECYCLE_ID
Context initialization parameter that defines the lifecycle ID used to identify the Faces Lifecycle used for this
application.
|
static String |
MAX_MANAGED_REQUEST_SCOPE_ATTR
Name of the init parameter with maximum number of bridge request scopes maintained by the bridge.
|
static 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 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 String |
PORTLET_ATTR_PREFIX
Per-portlet attributes prefix, for additional parameters, as described in the JSR 301 PLT 3.2
|
static String |
PORTLET_LIFECYCLE_PHASE
PortletRequest attribute set by the bridge prior to creating/acquiring a
FacesContext. |
static 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 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 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 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 String |
PRESERVE_ACTION_PARAM_ATTR_SUFFIX |
static 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 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 String |
RENDER_POLICY |
static String |
RENDER_POLICY_PARAM_ATTR_SUFFIX |
static String |
RESET_MODE_VIEWID
Allows portlets to reset the viewId when changing portlet modes.
|
static String |
SAVESTATE_FIELD_MARKER
Context initialization parameter that defines the SAVESTATE_FIELD_MARKER in use in the given deployment.
|
static String |
SESSION_APPLICATION_SCOPE_MAP |
static String |
VIEW_ID
PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method.
|
static 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 String |
VIEW_PATH
PortletRequest attribute that a portlet may set prior to calling the bridge's doFacesRequest() method.
|
static String |
VIEWID_HISTORY
PortletSession attribute set by the bridge to hold the last viewId accessed in a given mode.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Called by the portlet to take the bridge out of service.
|
void |
doFacesRequest(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
Called by the portlet when it wants the bridge to process an action request.
|
void |
doFacesRequest(javax.portlet.EventRequest request,
javax.portlet.EventResponse response)
Called by the portlet when it wants the bridge to process an event request.
|
void |
doFacesRequest(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
Called by the portlet when it wants the bridge to process a render request.
|
void |
doFacesRequest(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
Called by the portlet when it wants the bridge to process an in-protocol resource request.
|
void |
init(javax.portlet.PortletConfig config)
Called by the portlet.
|
static final String BRIDGE_PACKAGE_PREFIX
static final String MAX_MANAGED_REQUEST_SCOPES
static final String RENDER_POLICY
static final String LIFECYCLE_ID
static final String SAVESTATE_FIELD_MARKER
static final String EXCLUDED_REQUEST_ATTRIBUTES
static final String DEFAULT_VIEWID_MAP
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. static final String PRESERVE_ACTION_PARAMS
static final String BRIDGE_EVENT_HANDLER
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() + bridgeEventHandlerstatic final String BRIDGE_PUBLIC_RENDER_PARAMETER_HANDLER
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() + bridgeEventHandlerstatic final String DEFAULT_RENDERKIT_ID
static final String VIEW_ID
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. javax.portlet.faces.viewId: The value of this attribute identifies the Faces viewId the bridge must use for this request (e.g. /myFacesPage.jsp). This is expected to be a valid Faces viewId though it may optionally contain a query string.
static final String VIEW_PATH
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. javax.portlet.faces.viewPath: The value of this attribute contains the the Faces viewId the bridge must use for this request in ContextPath relative path form (e.g. /faces/myFacesPage.jsp). This value may optionally contain a query string.
static final String PORTLET_MODE_PARAMETER
static final String PORTLET_WINDOWSTATE_PARAMETER
static final String PORTLET_SECURE_PARAMETER
static final String DIRECT_LINK
static final String IN_PROTOCOL_RESOURCE_LINK
static final String BACK_LINK
static final String VIEW_LINK
h:outputLink.static final String IS_POSTBACK_ATTRIBUTE
static final String RENDER_CONTENT_AFTER_VIEW
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.static final String AFTER_VIEW_CONTENT
static final String PORTLET_LIFECYCLE_PHASE
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.static final String VIEWID_HISTORY
static final String PORTLET_NAMESPACED_RESPONSE_PROPERTY
NamingContainer that ensures all generated ids are namespaced using the consumer provided unique
portlet id.static final String NONFACES_TARGET_PATH_PARAMETER
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.static final String FACES_VIEW_ID_PARAMETER
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.
static final String FACES_VIEW_PATH_PARAMETER
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.
static final String FACES_USE_CURRENT_VIEW_PARAMETER
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.static final String SESSION_APPLICATION_SCOPE_MAP
static final String MAX_MANAGED_REQUEST_SCOPE_ATTR
static final String PORTLET_ATTR_PREFIX
static final String EXTENDED_PORTLET_ATTR_PREFIX
static final String PRESERVE_ACTION_PARAM_ATTR_SUFFIX
static final String RENDER_POLICY_PARAM_ATTR_SUFFIX
static final String DEFAULT_VIEW_ID_ATTR
static final String RESET_MODE_VIEWID
void init(javax.portlet.PortletConfig config)
throws BridgeException
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:
javax.portlet.faces.encodeRedirectURL: instructs the bridge to call
ExternalContext.encodeActionURL() before processing the redirect request. This exists because some
(newer) versions of JSF 1.2 call encodeActionURL before calling redirect while others
do not. This flag adjusts the behavior of the bridge in accordance with the JSF 1.2 implementation it runs with.
javax.portlet.faces.numManagedActionScopes: defines the maximum number of actionScopes this
bridge preserves at any given time. Value is an integer. ActionScopes are managed on a per Bridge class portlet
context wide basis. As a typical portlet application uses the same bridge implementation for all its Faces based
portlets, this means that all actionScopes are managed in a single bucket.NUM_MANAGED_ACTIONSCOPES constant.
javax.faces.lifecycleID: defines the Faces Lifecycle id that bridge uses when
acquiring the Faces.Lifecycle via which it executes the request. As a context wide attribute, all
bridge instances in this portlet application will use this lifecyle.
javax.portlet.faces.[portlet name].preserveActionParams: instructs the bridge to preserve action
parameters in the action scope and represent them in subsequent renders. Should be used only when binding to a
Faces implementation that relies on accessing such parameters during its render phase. As this is a
portlet/bridge instance specific attribute, the PortletContextattribute name is qualified by the
portlet instance name. This allows different portlets within the same portlet application to have different
settings.config - a PortletConfig object containing the portlet's configuration and initialization
parametersBridgeException - if an exception has occurred that interferes with the bridge's normal operation. For example, if
the bridge is already initialized.javax.portlet.UnavailableException - if the portlet cannot perform the initialization at this time.void doFacesRequest(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
throws BridgeException
request - the request object.response - the response object.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.void doFacesRequest(javax.portlet.EventRequest request,
javax.portlet.EventResponse response)
throws BridgeException
request - the request object.response - the response object.BridgeUninitializedException - thrown if the bridge is not initialized.BridgeException - all other internal exceptions are converted to a BridgeException.void doFacesRequest(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws BridgeException
request - the request object.response - the response object.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.void doFacesRequest(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
throws BridgeException
request - the request object.response - the response object.BridgeUninitializedException - thrown if the bridge is not initialized.BridgeException - all other internal exceptions are converted to a BridgeException.void destroy()
Copyright © 2015 JBoss by Red Hat. All rights reserved.