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 String |
BRIDGE_AUTO_DISPATCH_EVENTS
Portlet init parameter 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 String |
BRIDGE_CLASS
Application (PortletContext) init parameter that names the bridge class used by this application.
|
static String |
BRIDGE_SERVICE_CLASSPATH
Location of the services descriptor file in a brige installation that defines the class name of the bridge
implementation.
|
static 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 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 String |
DEFAULT_VIEWID
Portlet init parameter that defines the default ViewId that should be used when the request doesn't otherwise
convery the target.
|
| 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. |
String |
getBridgeClassName()
Returns the className of the bridge implementation this portlet uses.
|
BridgeEventHandler |
getBridgeEventHandler()
Returns an instance of a BridgeEventHandler used to process portlet events in a JSF environment.
|
BridgePublicRenderParameterHandler |
getBridgePublicRenderParameterHandler()
Returns an instance of a BridgePublicRenderParameterHandler used to post process public render parameter changes
that the bridge has pushed into mapped models.
|
String |
getDefaultRenderKitId()
Returns a String defining the default render kit id the bridge should ensure for this portlet.
|
Map<String,String> |
getDefaultViewIdMap()
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.
|
List<String> |
getExcludedRequestAttributes()
Returns the set of RequestAttribute names that the portlet wants the bridge to exclude from its managed request
scope.
|
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.
|
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. |
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()
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.
|
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 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 String BRIDGE_CLASS
public static final String BRIDGE_SERVICE_CLASSPATH
@Deprecated public static final String DEFAULT_CONTENT_TYPE
@Deprecated public static final String DEFAULT_CHARACTERSET_ENCODING
public static final String DEFAULT_VIEWID
PortletModepublic void destroy()
destroy in interface javax.portlet.Portletdestroy in class javax.portlet.GenericPortletpublic String getBridgeClassName()
null if it can't be
determined.public BridgeEventHandler getBridgeEventHandler() throws javax.portlet.PortletException
null if there is none.javax.portlet.PortletException - - if an error occurs loading or instantiating the BridgeEventHandler class.public BridgePublicRenderParameterHandler getBridgePublicRenderParameterHandler() throws javax.portlet.PortletException
null if there is none.javax.portlet.PortletException - - if an error occurs loading or instantiating the BridgePublicRenderParameterHandler class.public String getDefaultRenderKitId()
null is returned.public Map<String,String> getDefaultViewIdMap()
PortletMode. The entry key is the name of the
mode. The entry value is the default viewId for that mode.public List<String> getExcludedRequestAttributes()
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 String getResponseCharacterSetEncoding(javax.portlet.PortletRequest portletRequest)
GenericFacesPortlet but retained in case
a subclass has called it.portletRequest - The current portlet request.null@Deprecated public 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.public boolean isPreserveActionParameters()
public void processAction(javax.portlet.ActionRequest actionRequest,
javax.portlet.ActionResponse actionResponse)
throws javax.portlet.PortletException,
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.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,
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.IOException - - if an error occurs during event response processing.public void serveResource(javax.portlet.ResourceRequest resourceRequest,
javax.portlet.ResourceResponse resourceResponse)
throws javax.portlet.PortletException,
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.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,
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.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,
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.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,
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.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,
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.IOException - - if an error occurs while writing to the render response.Copyright © 2016 Liferay, Inc. All rights reserved.