com.javaplant.portlet
Class BaseMVCPortlet

java.lang.Object
  extended byjavax.portlet.GenericPortlet
      extended bycom.javaplant.portlet.BaseMVCPortlet
All Implemented Interfaces:
javax.portlet.Portlet, javax.portlet.PortletConfig

public abstract class BaseMVCPortlet
extends javax.portlet.GenericPortlet

A base class for portlets that provides a variety of behaviors and properties. Form bean behaviors -Automatic form-bean creation and population from request parameters. -a callback for validation of a form bean -form bean is placed in PortletRequest (RenderRequest) scope

Author:
Brad Smith Date: Aug 14, 2005

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
BaseMVCPortlet()
           
 
Method Summary
protected  PortletPage doEditRender(PortletForm form, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Template method - subclasses should override and provide custom EDIT-render processing if necessary.
protected  PortletPage doHelpRender(PortletForm form, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Template method - subclasses should override and provide custom HELP-render processing if necessary.
protected  void doInit()
          Template method - subclasses should override and provide custom portlet initialization.
protected abstract  void doProcessAction(PortletForm form, javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          Subclasses must provide an implementation of this method to handle portlet actions.
protected  PortletPage doViewRender(PortletForm form, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Template method - subclasses should override and provide custom VIEW-render processing if necessary.
protected  java.lang.String getEditPage()
          Returns the path to the JSP page that is configured for this portlet using portlet.jsp.edit.
protected  PortletForm getForm()
          Create a new instance of the PortletForm configured for this portlet.
protected  java.lang.String getHelpPage()
          Returns the path to the JSP page that is configured for this portlet using portlet.jsp.help.
protected  java.lang.String getPage(java.lang.String pageName)
          Get the path to an arbitrary JSP page component that is part of this portlet's configuration.
protected  java.lang.String getViewPage()
          Returns the path to the JSP page that is configured for this portlet using portlet.jsp.view.
 void init()
          This method creates the PortletConfiguration for this portlet based on the <init-param>'s in portlet.xml.
 void processAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          Standard Portlet API method.
 void render(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          This method enforces the BaseMVCPortlet-render lifecycle.
 
Methods inherited from class javax.portlet.GenericPortlet
destroy, doDispatch, doEdit, doHelp, doView, getInitParameter, getInitParameterNames, getPortletConfig, getPortletContext, getPortletName, getResourceBundle, getTitle, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

BaseMVCPortlet

public BaseMVCPortlet()
Method Detail

init

public final void init()
                throws javax.portlet.PortletException
This method creates the PortletConfiguration for this portlet based on the <init-param>'s in portlet.xml. It then invokes the template method doInit() which subclasses should override for custom portlet initialization.

Throws:
javax.portlet.PortletException

doInit

protected void doInit()
               throws javax.portlet.PortletException
Template method - subclasses should override and provide custom portlet initialization.

Throws:
javax.portlet.PortletException

processAction

public final void processAction(javax.portlet.ActionRequest request,
                                javax.portlet.ActionResponse response)
                         throws javax.portlet.PortletException,
                                java.io.IOException
Standard Portlet API method. This method cannot be overridden. The BaseMVCPortlet provides the implementation. Applications must provide an implementation of doProcessAction.

Parameters:
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

render

public final void render(javax.portlet.RenderRequest request,
                         javax.portlet.RenderResponse response)
                  throws javax.portlet.PortletException,
                         java.io.IOException
This method enforces the BaseMVCPortlet-render lifecycle. You do not override this method..

Parameters:
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

doProcessAction

protected abstract void doProcessAction(PortletForm form,
                                        javax.portlet.ActionRequest request,
                                        javax.portlet.ActionResponse response)
                                 throws javax.portlet.PortletException,
                                        java.io.IOException
Subclasses must provide an implementation of this method to handle portlet actions.

Parameters:
form -
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

doViewRender

protected PortletPage doViewRender(PortletForm form,
                                   javax.portlet.RenderRequest request,
                                   javax.portlet.RenderResponse response)
                            throws javax.portlet.PortletException,
                                   java.io.IOException
Template method - subclasses should override and provide custom VIEW-render processing if necessary. The default behavior is to return the JSP page associated with the portlet.jsp.view init-param in portlet.xml

Parameters:
form -
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

doEditRender

protected PortletPage doEditRender(PortletForm form,
                                   javax.portlet.RenderRequest request,
                                   javax.portlet.RenderResponse response)
                            throws javax.portlet.PortletException,
                                   java.io.IOException
Template method - subclasses should override and provide custom EDIT-render processing if necessary. The default behavior is to return the JSP page associated with the portlet.jsp.edit init-param in portlet.xml

Parameters:
form -
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

doHelpRender

protected PortletPage doHelpRender(PortletForm form,
                                   javax.portlet.RenderRequest request,
                                   javax.portlet.RenderResponse response)
                            throws javax.portlet.PortletException,
                                   java.io.IOException
Template method - subclasses should override and provide custom HELP-render processing if necessary. The default behavior is to return the JSP page associated with the portlet.jsp.help init-param in portlet.xml

Parameters:
form -
request -
response -
Throws:
javax.portlet.PortletException
java.io.IOException

getViewPage

protected final java.lang.String getViewPage()
Returns the path to the JSP page that is configured for this portlet using portlet.jsp.view.

Returns:
path to the VIEW-JSP page (null if not configured for this portlet).

getEditPage

protected final java.lang.String getEditPage()
Returns the path to the JSP page that is configured for this portlet using portlet.jsp.edit.

Returns:
path to the EDIT-JSP page (null if not configured for this portlet).

getHelpPage

protected final java.lang.String getHelpPage()
Returns the path to the JSP page that is configured for this portlet using portlet.jsp.help.

Returns:
path to the HELP-JSP page (null if not configured for this portlet).

getPage

protected final java.lang.String getPage(java.lang.String pageName)
Get the path to an arbitrary JSP page component that is part of this portlet's configuration.

Parameters:
pageName - name of page to get from PortletConfiguration.
Returns:
path to requested JSP page (null if page is not configured for portlet).

getForm

protected final PortletForm getForm()
Create a new instance of the PortletForm configured for this portlet.

Returns:
PortletForm for this portlet (null if class not found or not configured for portlet).