|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
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.
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 PortletMode s. |
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 |
---|
static final java.lang.String BRIDGE_PACKAGE_PREFIX
static final java.lang.String MAX_MANAGED_REQUEST_SCOPES
static final java.lang.String RENDER_POLICY
static final java.lang.String LIFECYCLE_ID
static final java.lang.String SAVESTATE_FIELD_MARKER
static final java.lang.String EXCLUDED_REQUEST_ATTRIBUTES
static final java.lang.String DEFAULT_VIEWID_MAP
PortletMode
s.
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 java.lang.String PRESERVE_ACTION_PARAMS
static final java.lang.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() + bridgeEventHandler
static final java.lang.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() + bridgeEventHandler
static final java.lang.String DEFAULT_RENDERKIT_ID
static final java.lang.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.
static final java.lang.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.
static final java.lang.String PORTLET_MODE_PARAMETER
static final java.lang.String PORTLET_WINDOWSTATE_PARAMETER
static final java.lang.String PORTLET_SECURE_PARAMETER
static final java.lang.String DIRECT_LINK
static final java.lang.String IN_PROTOCOL_RESOURCE_LINK
static final java.lang.String BACK_LINK
static final java.lang.String VIEW_LINK
h:outputLink
.
static final java.lang.String IS_POSTBACK_ATTRIBUTE
static final java.lang.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 java.lang.String AFTER_VIEW_CONTENT
static final java.lang.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 java.lang.String VIEWID_HISTORY
static final java.lang.String PORTLET_NAMESPACED_RESPONSE_PROPERTY
NamingContainer
that ensures all
generated ids are namespaced using the consumer provided unique portlet id.
static final java.lang.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 java.lang.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 java.lang.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 java.lang.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.
Method Detail |
---|
void init(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 PortletContext
attribute 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 parameters
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.void doFacesRequest(ActionRequest request, ActionResponse response) throws BridgeDefaultViewNotSpecifiedException, BridgeUninitializedException, 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(EventRequest request, EventResponse response) throws BridgeUninitializedException, 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(RenderRequest request, RenderResponse response) throws BridgeDefaultViewNotSpecifiedException, BridgeUninitializedException, 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(ResourceRequest request, ResourceResponse response) throws BridgeUninitializedException, 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |