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.javax.portlet.faces.defaultContentType: specifies on a per mode basis the content type the bridge should set
for all render requests it processes.javax.portlet.faces.defaultCharacterSetEncoding: specifies on a per mode basis the default character set
encoding the bridge should set for all render requests it processesGenericFacesPortlet 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
Portlet init parameter that defines the render response CharacterSetEncoding the bridge sets prior to rendering.
|
static String |
DEFAULT_CONTENT_TYPE
Portlet init parameter that defines the render response ContentType the bridge sets prior to rendering.
|
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() |
protected void |
doDispatch(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
If mode is VIEW, EDIT, or HELP -- defer to the doView, doEdit, doHelp so subclasses can override.
|
protected void |
doEdit(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response) |
protected void |
doHelp(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response) |
protected void |
doView(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response) |
String |
getBridgeClassName()
JSR 301 API method
|
BridgeEventHandler |
getBridgeEventHandler() |
BridgePublicRenderParameterHandler |
getBridgePublicRenderParameterHandler() |
String |
getDefaultRenderKitId()
Returns a String defining the default render kit id the bridge should ensure for this portlet.
|
Map<String,String> |
getDefaultViewIdMap()
JSR 301 API method
|
List<String> |
getExcludedRequestAttributes()
4.2.7 getExcludedRequestAttributes() As a portlet lifecycle allows multiple (re)renders to occur following an action, the
bridge manages an extended notion of a request scope to ensure that such rerenders produces identical results.
|
Bridge |
getFacesBridge()
Get current
Bridge instance. |
Bridge |
getFacesBridge(javax.portlet.PortletRequest request,
javax.portlet.PortletResponse response)
Returns an initialized bridge instance adequately prepared so the caller can
call doFacesRequest directly without further initialization.
|
String |
getResponseCharacterSetEncoding(javax.portlet.PortletRequest request)
Deprecated.
-- no longer used or called by the
GenericFacesPortlet but retained in case a subclass has
called it. |
String |
getResponseContentType(javax.portlet.PortletRequest request)
Deprecated.
-- no longer used or called by the
GenericFacesPortlet but retained in case a subclass has
called it. |
void |
init(javax.portlet.PortletConfig config)
Initialize generic faces portlet from portlet.xml
|
Boolean |
isAutoDispatchEvents()
Returns the value of the portlet initialization parameter javax.portlet.faces.autoDispatchEvents if non-null or true,
otherwise.
|
Boolean |
isPreserveActionParameters()
4.2.8 getPreserveActionParameters() By default the bridge doesn't preserve action parameters into subsequent renders.
|
void |
processAction(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response) |
void |
processEvent(javax.portlet.EventRequest request,
javax.portlet.EventResponse response) |
void |
serveResource(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response) |
doHeaders, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, renderpublic static final String BRIDGE_CLASS
public static final String DEFAULT_VIEWID
PortletModepublic static final String DEFAULT_CONTENT_TYPE
public static final String DEFAULT_CHARACTERSET_ENCODING
public static final String BRIDGE_AUTO_DISPATCH_EVENTS
public static final String BRIDGE_SERVICE_CLASSPATH
public void init(javax.portlet.PortletConfig config)
throws javax.portlet.PortletException
init in interface javax.portlet.Portletinit in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionpublic List<String> getExcludedRequestAttributes()
public Boolean isPreserveActionParameters()
public String getDefaultRenderKitId()
public Boolean isAutoDispatchEvents()
public BridgeEventHandler getBridgeEventHandler()
public BridgePublicRenderParameterHandler getBridgePublicRenderParameterHandler()
public String getBridgeClassName() throws javax.portlet.PortletException
javax.portlet.PortletExceptionpublic Bridge getFacesBridge(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response) throws javax.portlet.PortletException
javax.portlet.PortletException - exception acquiring or initializing the bridge.public Bridge getFacesBridge() throws javax.portlet.PortletException
Bridge instance. Bridge will be created and initialized on first request only.javax.portlet.PortletExceptionpublic void destroy()
destroy in interface javax.portlet.Portletdestroy in class javax.portlet.GenericPortletprotected void doDispatch(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws javax.portlet.PortletException,
IOException
doDispatch in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionprotected void doEdit(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws javax.portlet.PortletException,
IOException
doEdit in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionprotected void doHelp(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws javax.portlet.PortletException,
IOException
doHelp in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionprotected void doView(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
throws javax.portlet.PortletException,
IOException
doView in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionpublic void processAction(javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
throws javax.portlet.PortletException,
IOException
processAction in interface javax.portlet.PortletprocessAction in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionGenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)public void serveResource(javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
throws javax.portlet.PortletException,
IOException
serveResource in interface javax.portlet.ResourceServingPortletserveResource in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOExceptionpublic void processEvent(javax.portlet.EventRequest request,
javax.portlet.EventResponse response)
throws javax.portlet.PortletException,
IOException
processEvent in interface javax.portlet.EventPortletprocessEvent in class javax.portlet.GenericPortletjavax.portlet.PortletExceptionIOException@Deprecated public String getResponseCharacterSetEncoding(javax.portlet.PortletRequest request)
GenericFacesPortlet but retained in case a subclass has
called it.@Deprecated public String getResponseContentType(javax.portlet.PortletRequest request)
GenericFacesPortlet but retained in case a subclass has
called it.Copyright © 2015 JBoss by Red Hat. All rights reserved.