@ConsumerType
public class GenericFacesPortlet
extends javax.portlet.GenericPortlet
GenericFacesPortlet is provided to simplify development of a portlet that in whole or part relies on
the Faces Bridge to process requests. If all requests are to be handled by the bridge,
GenericFacesPortlet is a turnkey implementation. Developers do not need to subclass it. However, if there are
some situations where the portlet doesn't require bridge services then GenericFacesPortlet can be
subclassed and overriden.
Since GenericFacesPortlet subclasses GenericPortlet care is taken to all subclasses to
override naturally. For example, though doDispatch() is overriden, requests are only dispatched to the
bridge from here if the PortletMode isn't VIEW, EDIT, or HELP.
The GenericFacesPortlet recognizes the following portlet initialization parameters:
javax.portlet.faces.defaultViewId.[mode]: specifies on a per mode basis the default viewId
the Bridge executes when not already encoded in the incoming request. A value must be defined for each
PortletMode the Bridge is expected to process.javax.portlet.faces.excludedRequestAttributes: specifies on a per portlet basis the set of request
attributes the bridge is to exclude from its request scope. The value of this parameter is a comma delimited list
of either fully qualified attribute names or a partial attribute name of the form packageName.*. In this
later case all attributes exactly prefixed by packageName are excluded, non recursive.javax.portlet.faces.preserveActionParams: specifies on a per portlet basis whether the bridge
should preserve parameters received in an action request and restore them for use during subsequent renders.GenericFacesPortlet recognizes the following application (PortletContext)
initialization parameters:
javax.portlet.faces.BridgeImplClass: specifies the Bridgeimplementation class used by
this portlet. Typically this initialization parameter isn't set as the GenericFacesPortlet defaults
to finding the class name from the bridge configuration. However if more then one bridge is configured in the
environment such per application configuration is necessary to force a specific bridge to be used.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BRIDGE_AUTO_DISPATCH_EVENTS
Portlet init-param containing the setting for whether the
GenericFacesPortlet overrides event
processing by dispatching all events to the bridge or delegates all event processing to the
GenericPortlet. |
static java.lang.String |
BRIDGE_CLASS
Application (PortletContext) init parameter that names the bridge class used by this application.
|
static java.lang.String |
BRIDGE_SERVICE_CLASSPATH
Location of the services descriptor file in a brige installation that defines the class name of the bridge
implementation.
|
static java.lang.String |
DEFAULT_CHARACTERSET_ENCODING
Deprecated.
Portlet init parameter that defines the render response CharacterSetEncoding the bridge sets prior
to rendering. Typcially only set when the jsp outputs an encoding other then the portlet container's
and the portlet container supports response encoding transformation. It is deprecated because bridge
implementations (since JSR 329) no longer utilize it.
|
static java.lang.String |
DEFAULT_CONTENT_TYPE
Deprecated.
Portlet init parameter that defines the render response ContentType the bridge sets prior to
rendering. If not set the bridge uses the request's preferred content type. It is deprecated because
bridge implementations (since JSR 329) no longer utilize it.
|
static java.lang.String |
DEFAULT_VIEWID
Portlet init parameter that defines the default ViewId that should be used when the request doesn't otherwise
convery the target.
|
static java.lang.String |
INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES
Portlet init-param that determines whether or not the
init(PortletConfig) method sets PortletContext attributes from PortletConfig init-param values, such that they are namespaced with the
portlet name. |
| Constructor and Description |
|---|
GenericFacesPortlet() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Release resources, specifically it destroys the bridge.
|
protected void |
doDispatch(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
If the
javax.portlet.faces.automaticNonFacesViewDispatching init-param is true and the
Bridge.NONFACES_TARGET_PATH_PARAMETER render request parameter specifies a value as a non-Faces target
path, then forward to the non-Faces target path. |
protected void |
doEdit(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
Delegates to
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.EDIT. |
protected void |
doHeaders(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse) |
protected void |
doHelp(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
Delegates to
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.HELP. |
protected void |
doView(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
Delegates to
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.VIEW. |
java.lang.String |
getBridgeClassName()
Returns the className of the bridge implementation this portlet uses.
|
BridgeEventHandler |
getBridgeEventHandler()
Deprecated.
Call
BridgeEventHandlerFactory.getBridgeEventHandler(PortletConfig) instead.
Returns an instance of a BridgeEventHandler used to process portlet events in a JSF environment. This default implementation looks for a portlet initParameter that names the class used to instantiate the handler. Note that this method will only be called by |
BridgePublicRenderParameterHandler |
getBridgePublicRenderParameterHandler()
Deprecated.
Call
BridgePublicRenderParameterHandlerFactory.getBridgePublicRenderParameterHandler(PortletConfig)
instead.
Returns an instance of a BridgePublicRenderParameterHandler used to post process public render parameter changes that the bridge has pushed into mapped models. This default implementation looks for a portlet initParameter that names the class used to instantiate the handler. Note that this method will only be called by |
java.lang.String |
getDefaultRenderKitId()
Deprecated.
Call
ExternalContext.getInitParameter(String) with parameter value
"javax.portlet.faces.defaultRenderKitId" instead.
Returns a String defining the default render kit id the bridge should ensure for this portlet. If
non-null, this value is used to override any default render kit id set on an app wide basis in the
faces-config.xml. This default implementation reads the values from the portlet init-param
javax.portlet.faces.defaultRenderKitId. If not present, Note that this method will only be called by |
java.util.Map<java.lang.String,java.lang.String> |
getDefaultViewIdMap()
Deprecated.
Call
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.defaultViewId.view", "javax.portlet.faces.defaultViewId.edit", or
"javax.portlet.faces.defaultViewId.help", etc.
Returns a map of default viewIds that the bridge should use when it is unable to resolve to a
specific target in the incoming request. There is one entry per support Note that this method will only be called by |
java.util.List<java.lang.String> |
getExcludedRequestAttributes()
Deprecated.
Call
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.excludedRequestAttributes" instead.
Returns the set of RequestAttribute names that the portlet wants the bridge to exclude from its managed request scope. This default implementation picks up this list from the comma delimited init-param javax.portlet.faces.excludedRequestAttributes. Note that this method will only be called by |
Bridge |
getFacesBridge(javax.portlet.PortletRequest portletRequest,
javax.portlet.PortletResponse portletResponse)
Returns an initialized bridge instance adequately prepared so the caller can call doFacesRequest directly without
further initialization.
|
java.lang.String |
getResponseCharacterSetEncoding(javax.portlet.PortletRequest portletRequest)
Deprecated.
This method is no longer used or called by the
GenericFacesPortlet but retained in case
a subclass has called it. |
java.lang.String |
getResponseContentType(javax.portlet.PortletRequest portletRequest)
Deprecated.
This method is no longer used or called by the
GenericFacesPortlet but retained in case
a subclass has called it. |
void |
init(javax.portlet.PortletConfig portletConfig)
Initializes the
GenericFacesPortlet according to the specified portlet configuration. |
boolean |
isAutoDispatchEvents()
Returns the value of the portlet initialization parameter
javax.portlet.faces.autoDispatchEvents if
non-null or true, otherwise. |
boolean |
isPreserveActionParameters()
Deprecated.
Call
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.preserveActionParams" instead.
Returns a boolean indicating whether or not the bridge should preserve all the action parameters in the subsequent renders that occur in the same scope. This default implementation reads the values from the portlet init-param javax.portlet.faces.preserveActionParams. If not present, false is returned. Note that this method will only be called by |
void |
processAction(javax.portlet.ActionRequest actionRequest,
javax.portlet.ActionResponse actionResponse)
Delegates to
Bridge.doFacesRequest(ActionRequest, ActionResponse). |
void |
processEvent(javax.portlet.EventRequest eventRequest,
javax.portlet.EventResponse eventResponse)
Delegates to
Bridge.doFacesRequest(EventRequest, EventResponse). |
void |
serveResource(javax.portlet.ResourceRequest resourceRequest,
javax.portlet.ResourceResponse resourceResponse)
Delegates to
Bridge.doFacesRequest(ResourceRequest, ResourceResponse). |
getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, renderpublic static final java.lang.String BRIDGE_AUTO_DISPATCH_EVENTS
GenericFacesPortlet overrides event
processing by dispatching all events to the bridge or delegates all event processing to the
GenericPortlet. Default is true.public static final java.lang.String BRIDGE_CLASS
public static final java.lang.String INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES
init(PortletConfig) method sets PortletContext attributes from PortletConfig init-param values, such that they are namespaced with the
portlet name. Default is false. Specify true in order to enable JSR 301/329 legacy
behavior. See also the following deprecated methods:
public static final java.lang.String BRIDGE_SERVICE_CLASSPATH
@Deprecated public static final java.lang.String DEFAULT_CONTENT_TYPE
@Deprecated public static final java.lang.String DEFAULT_CHARACTERSET_ENCODING
public static final java.lang.String DEFAULT_VIEWID
PortletModepublic void destroy()
destroy in interface javax.portlet.Portletdestroy in class javax.portlet.GenericPortletpublic java.lang.String getBridgeClassName()
null if it can't be
determined.@Deprecated public BridgeEventHandler getBridgeEventHandler() throws javax.portlet.PortletException
BridgeEventHandlerFactory.getBridgeEventHandler(PortletConfig) instead.
Returns an instance of a BridgeEventHandler used to process portlet events in a JSF environment. This default implementation looks for a portlet initParameter that names the class used to instantiate the handler.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
null if there is none.javax.portlet.PortletException - - if an error occurs loading or instantiating the BridgeEventHandler
class.@Deprecated public BridgePublicRenderParameterHandler getBridgePublicRenderParameterHandler() throws javax.portlet.PortletException
BridgePublicRenderParameterHandlerFactory.getBridgePublicRenderParameterHandler(PortletConfig)
instead.
Returns an instance of a BridgePublicRenderParameterHandler used to post process public render parameter changes that the bridge has pushed into mapped models. This default implementation looks for a portlet initParameter that names the class used to instantiate the handler.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
null if there is none.javax.portlet.PortletException - - if an error occurs loading or instantiating the BridgePublicRenderParameterHandler class.@Deprecated public java.lang.String getDefaultRenderKitId()
ExternalContext.getInitParameter(String) with parameter value
"javax.portlet.faces.defaultRenderKitId" instead.
Returns a String defining the default render kit id the bridge should ensure for this portlet. If
non-null, this value is used to override any default render kit id set on an app wide basis in the
faces-config.xml. This default implementation reads the values from the portlet init-param
javax.portlet.faces.defaultRenderKitId. If not present, null is returned.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
@Deprecated public java.util.Map<java.lang.String,java.lang.String> getDefaultViewIdMap()
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.defaultViewId.view", "javax.portlet.faces.defaultViewId.edit", or
"javax.portlet.faces.defaultViewId.help", etc.
Returns a map of default viewIds that the bridge should use when it is unable to resolve to a
specific target in the incoming request. There is one entry per support PortletMode.
The entry key is the name of the mode. The entry value is the default viewId for that mode.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
@Deprecated public java.util.List<java.lang.String> getExcludedRequestAttributes()
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.excludedRequestAttributes" instead.
Returns the set of RequestAttribute names that the portlet wants the bridge to exclude from its managed request scope. This default implementation picks up this list from the comma delimited init-param javax.portlet.faces.excludedRequestAttributes.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
null if it can't be
determined.public Bridge getFacesBridge(javax.portlet.PortletRequest portletRequest, javax.portlet.PortletResponse portletResponse) throws javax.portlet.PortletException
portletRequest - The current portlet request.portletResponse - The current portlet response.javax.portlet.PortletException - - if an error occurs acquiring or initializing the bridge.@Deprecated public java.lang.String getResponseCharacterSetEncoding(javax.portlet.PortletRequest portletRequest)
GenericFacesPortlet but retained in case
a subclass has called it.portletRequest - The current portlet request.null@Deprecated public java.lang.String getResponseContentType(javax.portlet.PortletRequest portletRequest)
GenericFacesPortlet but retained in case
a subclass has called it.portletRequest - The current portlet request.PortletRequest.getResponseContentType().public void init(javax.portlet.PortletConfig portletConfig)
throws javax.portlet.PortletException
GenericFacesPortlet according to the specified portlet configuration.init in interface javax.portlet.Portletinit in class javax.portlet.GenericPortletportletConfig - The portlet configuration.javax.portlet.PortletException - - if an error occurs acquiring or initializing the bridge.public boolean isAutoDispatchEvents()
javax.portlet.faces.autoDispatchEvents if
non-null or true, otherwise.@Deprecated public boolean isPreserveActionParameters()
ExternalContext.getInitParameter(String) with parameter
"javax.portlet.faces.preserveActionParams" instead.
Returns a boolean indicating whether or not the bridge should preserve all the action parameters in the subsequent renders that occur in the same scope. This default implementation reads the values from the portlet init-param javax.portlet.faces.preserveActionParams. If not present, false is returned.
Note that this method will only be called by init(PortletConfig) if the INITIALIZE_NAMESPACED_CONTEXT_ATTRIBUTES init-param is true in
WEB-INF/portlet.xml.
public void processAction(javax.portlet.ActionRequest actionRequest,
javax.portlet.ActionResponse actionResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(ActionRequest, ActionResponse).processAction in interface javax.portlet.PortletprocessAction in class javax.portlet.GenericPortletactionRequest - The current action request.actionResponse - The current action response.javax.portlet.PortletException - - if an error occurs during action request/response processing.java.io.IOException - - if an error occurs during action response processing such as a call to ActionResponse.sendRedirect(String).public void processEvent(javax.portlet.EventRequest eventRequest,
javax.portlet.EventResponse eventResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(EventRequest, EventResponse).processEvent in interface javax.portlet.EventPortletprocessEvent in class javax.portlet.GenericPortleteventRequest - The current event request.eventResponse - The current event response.javax.portlet.PortletException - - if an error occurs during event request/response processing.java.io.IOException - - if an error occurs during event response processing.public void serveResource(javax.portlet.ResourceRequest resourceRequest,
javax.portlet.ResourceResponse resourceResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(ResourceRequest, ResourceResponse).serveResource in interface javax.portlet.ResourceServingPortletserveResource in class javax.portlet.GenericPortletresourceRequest - The current resource request.resourceResponse - The current resource response.javax.portlet.PortletException - - if an error occurs during resource request/response processing.java.io.IOException - - if an error occurs while writing to the resource response.protected void doDispatch(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
throws javax.portlet.PortletException,
java.io.IOException
javax.portlet.faces.automaticNonFacesViewDispatching init-param is true and the
Bridge.NONFACES_TARGET_PATH_PARAMETER render request parameter specifies a value as a non-Faces target
path, then forward to the non-Faces target path. Otherwise, delegates to the GenericPortlet.doDispatch(RenderRequest, RenderResponse) method so that the doView(RenderRequest,
RenderResponse), doEdit(RenderRequest, RenderResponse), or doHelp(RenderRequest,
RenderResponse) methods will handle the dispatching.doDispatch in class javax.portlet.GenericPortletrenderRequest - The current render request.renderResponse - The current render response.javax.portlet.PortletException - - if an error occurs during render request/response processing.java.io.IOException - - if an error occurs while writing to the render response.protected void doEdit(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.EDIT.doEdit in class javax.portlet.GenericPortletrenderRequest - The current render request.renderResponse - The current render response.javax.portlet.PortletException - - if an error occurs during render request/response processing.java.io.IOException - - if an error occurs while writing to the render response.protected void doHeaders(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
doHeaders in class javax.portlet.GenericPortletprotected void doHelp(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.HELP.doHelp in class javax.portlet.GenericPortletrenderRequest - The current render request.renderResponse - The current render response.javax.portlet.PortletException - - if an error occurs during render request/response processing.java.io.IOException - - if an error occurs while writing to the render response.protected void doView(javax.portlet.RenderRequest renderRequest,
javax.portlet.RenderResponse renderResponse)
throws javax.portlet.PortletException,
java.io.IOException
Bridge.doFacesRequest(RenderRequest, RenderResponse) in order to render the Faces view
associated with PortletMode.VIEW.doView in class javax.portlet.GenericPortletrenderRequest - The current render request.renderResponse - The current resource request.javax.portlet.PortletException - - if an error occurs during render request/response processing.java.io.IOException - - if an error occurs while writing to the render response.Copyright © 2020 Liferay, Inc. All Rights Reserved.