org.apache.portals.bridges.velocity
Class GenericVelocityPortlet

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

public class GenericVelocityPortlet
extends 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 java.lang.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
 
Constructor Summary
GenericVelocityPortlet()
           
 
Method Summary
 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 java.lang.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
Specified by:
init in interface javax.portlet.Portlet
Overrides:
init in class GenericServletPortlet
Throws:
javax.portlet.PortletException

processAction

public void processAction(javax.portlet.ActionRequest request,
                          javax.portlet.ActionResponse actionResponse)
                   throws javax.portlet.PortletException,
                          java.io.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()

Specified by:
processAction in interface javax.portlet.Portlet
Overrides:
processAction in class GenericServletPortlet
Throws:
javax.portlet.PortletException
java.io.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,
                     java.io.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.

Overrides:
doCustom in class GenericServletPortlet
Throws:
javax.portlet.PortletException
java.io.IOException
See Also:
javax.portlet.GenericPortlet#doCustom

doEdit

public void doEdit(javax.portlet.RenderRequest request,
                   javax.portlet.RenderResponse response)
            throws javax.portlet.PortletException,
                   java.io.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.

Overrides:
doEdit in class GenericServletPortlet
Throws:
javax.portlet.PortletException
java.io.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,
                   java.io.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.

Overrides:
doHelp in class GenericServletPortlet
Throws:
javax.portlet.PortletException
java.io.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,
                   java.io.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.

Overrides:
doView in class GenericServletPortlet
Throws:
javax.portlet.PortletException
java.io.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,
                   java.io.IOException
Specified by:
render in interface javax.portlet.Portlet
Overrides:
render in class javax.portlet.GenericPortlet
Throws:
javax.portlet.PortletException
java.io.IOException

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,
                              java.io.IOException
Throws:
javax.portlet.PortletException
java.io.IOException


Copyright © 1999-2011 Apache Software Foundation. All Rights Reserved.