javax.portlet.faces
Class GenericFacesPortlet

java.lang.Object
  extended by javax.portlet.GenericPortlet
      extended by javax.portlet.faces.GenericFacesPortlet
All Implemented Interfaces:
Portlet, PortletConfig

public class GenericFacesPortlet
extends GenericPortlet

The 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 init parameters:

The GenericFacesPortlet recognizes the following PortletContext init parameters:


Field Summary
static String BRIDGE_CLASS
           
static String BRIDGE_SERVICE_CLASSPATH
           
 
Constructor Summary
GenericFacesPortlet()
           
 
Method Summary
 void destroy()
          Release resources
 void doDispatch(RenderRequest request, RenderResponse response)
          If mode is VIEW, EDIT, or HELP -- defer to the doView, doEdit, doHelp so subclasses can override.
protected  void doEdit(RenderRequest request, RenderResponse response)
           
protected  void doHelp(RenderRequest request, RenderResponse response)
           
protected  void doView(RenderRequest request, RenderResponse response)
           
 String getBridgeClassName()
          Returns the className of the bridge implementation this portlet uses.
 String getDefaultViewId(PortletRequest request, PortletMode mode)
          Returns the defaultViewId to be used for this request.
 List<String> getExcludedRequestAttributes()
          Returns the set of RequestAttribute names that the portlet wants the bridge to exclude from its managed request scope.
 Boolean getPreserveActionParameters()
          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 init(PortletConfig portletConfig)
          Initialize generic faces portlet from portlet.xml
 void processAction(ActionRequest request, ActionResponse response)
           
 
Methods inherited from class javax.portlet.GenericPortlet
getInitParameter, getInitParameterNames, getPortletConfig, getPortletContext, getPortletName, getResourceBundle, getTitle, init, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BRIDGE_CLASS

public static final String BRIDGE_CLASS
See Also:
Constant Field Values

BRIDGE_SERVICE_CLASSPATH

public static final String BRIDGE_SERVICE_CLASSPATH
See Also:
Constant Field Values
Constructor Detail

GenericFacesPortlet

public GenericFacesPortlet()
Method Detail

init

public void init(PortletConfig portletConfig)
          throws PortletException
Initialize generic faces portlet from portlet.xml

Specified by:
init in interface Portlet
Overrides:
init in class GenericPortlet
Throws:
PortletException

destroy

public void destroy()
Release resources

Specified by:
destroy in interface Portlet
Overrides:
destroy in class GenericPortlet

doDispatch

public void doDispatch(RenderRequest request,
                       RenderResponse response)
                throws PortletException,
                       IOException
If mode is VIEW, EDIT, or HELP -- defer to the doView, doEdit, doHelp so subclasses can override. Otherwise handle mode here if there is a defaultViewId mapping for it.

Overrides:
doDispatch in class GenericPortlet
Throws:
PortletException
IOException

doEdit

protected void doEdit(RenderRequest request,
                      RenderResponse response)
               throws PortletException,
                      IOException
Overrides:
doEdit in class GenericPortlet
Throws:
PortletException
IOException

doHelp

protected void doHelp(RenderRequest request,
                      RenderResponse response)
               throws PortletException,
                      IOException
Overrides:
doHelp in class GenericPortlet
Throws:
PortletException
IOException

doView

protected void doView(RenderRequest request,
                      RenderResponse response)
               throws PortletException,
                      IOException
Overrides:
doView in class GenericPortlet
Throws:
PortletException
IOException

processAction

public void processAction(ActionRequest request,
                          ActionResponse response)
                   throws PortletException,
                          IOException
Specified by:
processAction in interface Portlet
Overrides:
processAction in class GenericPortlet
Throws:
PortletException
IOException

getExcludedRequestAttributes

public List<String> getExcludedRequestAttributes()
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.

Returns:
a List containing the names of the attributes to be excluded. null if it can't be determined.

getPreserveActionParameters

public Boolean getPreserveActionParameters()
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.

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.

getBridgeClassName

public String getBridgeClassName()
Returns the className of the bridge implementation this portlet uses. Subclasses override to alter the default behavior. Default implementation first checks for a portlet context init parameter: javax.portlet.faces.BridgeImplClass. If it doesn't exist then it looks for the resource file "/META-INF/services/javax.portlet.faces.Bridge" using the current threads classloader and extracts the classname from the first line in that file.

Returns:
the class name of the Bridge class the GenericFacesPortlet uses. null if it can't be determined.

getDefaultViewId

public String getDefaultViewId(PortletRequest request,
                               PortletMode mode)
Returns the defaultViewId to be used for this request. The defaultViewId is depends on the PortletMode.

Parameters:
request - the request object.
mode - the mode which to return the defaultViewId for.
Returns:
the defaultViewId for this mode


Copyright © 2007-2008 The Apache Software Foundation. All Rights Reserved.