org.apache.portals.bridges.velocity
Class GenericVelocityPortlet

java.lang.Object
  extended byjavax.portlet.GenericPortlet
      extended byorg.apache.portals.bridges.common.GenericServletPortlet
          extended byorg.apache.portals.bridges.velocity.GenericVelocityPortlet
All Implemented Interfaces:
javax.portlet.Portlet, javax.portlet.PortletConfig
Direct Known Subclasses:
AbstractVelocityMessagingPortlet

public class GenericVelocityPortlet
extends org.apache.portals.bridges.common.GenericServletPortlet

Generic Velocity Portlet emulating basic functionality provided in the Portlet API (for JSPs) to Velocity portlets and templates. Provides the following Velocity context variables emulating PLT.22 JSP request variables: *

PLT.22 Tags:

Beware that Param tags cannot be added incrementally i.e. $renderURL.setParameter("name","value").setParameter("name","value") since the portlet api returns void on setParameter (or setWindowState, setPortletMode) Thus it is required to set each param or state on a single line:

#set($max = $renderResponse.createRenderURL()) $max.setWindowState($STATE_MAX) $max.setParameter("bush", "war")

Constants: $MODE_EDIT, $MODE_HELP, $MODE_VIEW, $STATE_NORMAL, $STATE_MIN, $STATE_MAX, $USER_INFO

Version:
$Id: GenericVelocityPortlet.java,v 1.1 2004/10/29 01:29:50 taylor Exp $
Author:
David Sean Taylor

Field Summary
static String PORTLET_BRIDGE_CONTEXT
           
 
Fields inherited from class org.apache.portals.bridges.common.GenericServletPortlet
PARAM_ACTION_PAGE, PARAM_ALLOW_PREFERENCES, PARAM_CUSTOM_PAGE, PARAM_EDIT_PAGE, PARAM_HELP_PAGE, PARAM_MAX_PAGE, PARAM_VIEW_PAGE
 
Fields inherited from class javax.portlet.GenericPortlet
 
Constructor Summary
GenericVelocityPortlet()
           
 
Method Summary
private  org.apache.velocity.context.Context createPortletVelocityContext(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void doCustom(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Execute the servlet as define by the init parameter or preference PARAM_EDIT_PAGE.
 void doEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Execute the servlet as define by the init parameter or preference PARAM_EDIT_PAGE.
 void doHelp(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Execute the servlet as define by the init parameter or preference PARAM_HELP_PAGE.
 void doPreferencesEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          Execute the servlet as define by the init parameter or preference PARAM_VIEW_PAGE.
 org.apache.velocity.context.Context getContext(javax.portlet.RenderRequest request)
           
 org.apache.velocity.context.Context getContext(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void init(javax.portlet.PortletConfig config)
           
 void processAction(javax.portlet.ActionRequest request, javax.portlet.ActionResponse actionResponse)
          Execute the servlet as define by the init parameter or preference PARAM_ACTION_PAGE.
 void render(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 void setupPreferencesEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
           
 
Methods inherited from class org.apache.portals.bridges.common.GenericServletPortlet
getDefaultActionPage, getDefaultCustomPage, getDefaultEditPage, getDefaultHelpPage, getDefaultViewPage, processPreferencesAction, setDefaultActionPage, setDefaultCustomPage, setDefaultEditPage, setDefaultHelpPage, setDefaultViewPage
 
Methods inherited from class javax.portlet.GenericPortlet
destroy, doDispatch, 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

PORTLET_BRIDGE_CONTEXT

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

GenericVelocityPortlet

public GenericVelocityPortlet()
Method Detail

init

public void init(javax.portlet.PortletConfig config)
          throws javax.portlet.PortletException
Throws:
javax.portlet.PortletException

processAction

public void processAction(javax.portlet.ActionRequest request,
                          javax.portlet.ActionResponse actionResponse)
                   throws javax.portlet.PortletException,
                          IOException
Execute the servlet as define by the init parameter or preference PARAM_ACTION_PAGE. The value if the parameter is a relative URL, i.e. /actionPage.jsp will execute the JSP editPage.jsp in the portlet application's web app. The action should not generate any content. The content will be generate by doCustom(), doHelp() , doEdit(), or doView(). See section PLT.16.2 of the JSR 168 Portlet Spec for more information around executing a servlet or JSP in processAction()

Throws:
javax.portlet.PortletException
IOException
See Also:
GenericPortlet.processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)

doCustom

public void doCustom(javax.portlet.RenderRequest request,
                     javax.portlet.RenderResponse response)
              throws javax.portlet.PortletException,
                     IOException
Execute the servlet as define by the init parameter or preference PARAM_EDIT_PAGE. The value if the parameter is a relative URL, i.e. /editPage.jsp will execute the JSP editPage.jsp in the portlet application's web app.

Throws:
javax.portlet.PortletException
IOException
See Also:
javax.portlet.GenericPortlet#doCustom

doEdit

public void doEdit(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   IOException
Execute the servlet as define by the init parameter or preference PARAM_EDIT_PAGE. The value if the parameter is a relative URL, i.e. /editPage.jsp will execute the JSP editPage.jsp in the portlet application's web app.

Throws:
javax.portlet.PortletException
IOException
See Also:
GenericPortlet.doEdit(javax.portlet.RenderRequest, javax.portlet.RenderResponse)

doHelp

public void doHelp(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   IOException
Execute the servlet as define by the init parameter or preference PARAM_HELP_PAGE. The value if the parameter is a relative URL, i.e. /helpPage.jsp will exeute the JSP helpPage.jsp in the portlet application's web app.

Throws:
javax.portlet.PortletException
IOException
See Also:
GenericPortlet.doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)

doView

public void doView(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   IOException
Execute the servlet as define by the init parameter or preference PARAM_VIEW_PAGE. The value if the parameter is a relative URL, i.e. /viewPage.jsp will execute the JSP viewPage.jsp in the portlet application's web app.

Throws:
javax.portlet.PortletException
IOException
See Also:
GenericPortlet.doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)

render

public void render(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   IOException
Throws:
javax.portlet.PortletException
IOException

createPortletVelocityContext

private org.apache.velocity.context.Context createPortletVelocityContext(javax.portlet.RenderRequest request,
                                                                         javax.portlet.RenderResponse response)

getContext

public org.apache.velocity.context.Context getContext(javax.portlet.RenderRequest request)

getContext

public org.apache.velocity.context.Context getContext(javax.portlet.RenderRequest request,
                                                      javax.portlet.RenderResponse response)

setupPreferencesEdit

public void setupPreferencesEdit(javax.portlet.RenderRequest request,
                                 javax.portlet.RenderResponse response)

doPreferencesEdit

public void doPreferencesEdit(javax.portlet.RenderRequest request,
                              javax.portlet.RenderResponse response)
                       throws javax.portlet.PortletException,
                              IOException
Throws:
javax.portlet.PortletException
IOException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.