com.ibm.portal.struts.command
Class StrutsViewActionCommand

java.lang.Object
  extended by com.ibm.portal.struts.command.StrutsViewCommand
      extended by com.ibm.portal.struts.command.StrutsViewActionCommand
All Implemented Interfaces:
IViewCommand, java.io.Serializable

public class StrutsViewActionCommand
extends StrutsViewCommand

Command pattern class used to execute a render action. When the request processor detects a Struts action that implements the IStrutsPrepareRender action, the ViewCommandFactory will create this command object. When this command object is executed, the Struts action will be executed.

Since:
5.1
See Also:
Serialized Form

Field Summary
protected static MessageResources messages
          The message resources for the Struts Portlet Framework.
protected static java.lang.String URI
          Name of request attribute for the URI string.
 
Fields inherited from class com.ibm.portal.struts.command.StrutsViewCommand
CONTENT_TYPE, PREFIX
 
Constructor Summary
StrutsViewActionCommand()
          Constructs the StrutsViewActionCommand object.
StrutsViewActionCommand(java.lang.String uri, PortletRequest request)
          Construct the StrutsViewActionCommand object.
 
Method Summary
static void addAttributeNameToSave(java.lang.String attributeName)
          Adds the name of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase.
static void addAttributeTypeToSave(java.lang.Class attributeType)
          Adds the class type of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase.
 void RenderResponse, com.ibm.portal.struts.command.ViewCommandExecutionContext)">execute(RenderRequest request, RenderResponse response, ViewCommandExecutionContext executionContext)
          Executes the given command given the request and response objects.
 java.lang.String PortletRequest)">getUri(PortletRequest request)
          Returns the URI.
static void removeAttributeNameToSave(java.lang.String attributeName)
          Removes the name of an attribute from the list of attribute names to save.
static void removeAttributeTypeToSave(java.lang.Class attributeType)
          Removes the class type of the request attribute from the list of attributes to save.
 void saveAttributes(PortletRequest request, ViewCommandExecutionContext executionContext)
          Saves the attributes specific to action rendering.
 void setUri(PortletRequest request, java.lang.String uri)
          Sets the URI for this command.
 
Methods inherited from class com.ibm.portal.struts.command.StrutsViewCommand
addAttribute, PortletRequest)">getContentType, getPrefix, getRemoveOnModeChange, getSavedAttributes, PortletResponse, com.ibm.portal.struts.command.ViewCommandExecutionContext)">getSavedCommand, removeAttribute, RenderRequest)">repopulateRequest, saveAsAttribute, saveAttribute, saveAttributes, saveCommand, PortletResponse, java.lang.String)">saveCommand, setContentType, setContentType, setPrefix, setRemoveOnModeChange, setSavedAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URI

protected static final java.lang.String URI
Name of request attribute for the URI string.

See Also:
Constant Field Values

messages

protected static MessageResources messages
The message resources for the Struts Portlet Framework.

Constructor Detail

StrutsViewActionCommand

public StrutsViewActionCommand()
Constructs the StrutsViewActionCommand object. The URI should be set through the setUri method if this constructor is used.


StrutsViewActionCommand

public StrutsViewActionCommand(java.lang.String uri,
                               PortletRequest request)
Construct the StrutsViewActionCommand object. The URI is the path for a Struts action and matches the configured Struts servlet mapping. The command is typically created in the action phase of Portal so a PortletRequest object is expected.

Parameters:
uri - the URI path to the JSP
request - The request object to save context information from
Method Detail
PortletRequest)">

getUri

public java.lang.String getUri(PortletRequest request)
Returns the URI. The URI is the path for a Struts action and matches the configured Struts servlet mapping. The command is typically created in the action phase of Portal so a PortletRequest object is expected.

Parameters:
request - the portlet request object
Returns:
returns the URI

setUri

public void setUri(PortletRequest request,
                   java.lang.String uri)
Sets the URI for this command. The URI is a Struts action and matches the configured Struts servlet mapping. The command is typically created in the action phase of Portal so a PortletRequest object is expected.

Parameters:
request - the portlet request object
uri - the URI for the JSP.

RenderResponse, com.ibm.portal.struts.command.ViewCommandExecutionContext)">

execute

public void execute(RenderRequest request,
                    RenderResponse response,
                    ViewCommandExecutionContext executionContext)
             throws PortletException
Executes the given command given the request and response objects. The execute method is always called in the render phase of Portal and therefore the RenderRequest and RenderResponse objects are expected.

Specified by:
RenderResponse, com.ibm.portal.struts.command.ViewCommandExecutionContext)">execute in interface IViewCommand
Overrides:
execute in class StrutsViewCommand
Parameters:
request - The request object
response - The response object
executionContext - the execution context object
Throws:
PortletException - if the request cannot be fulfilled

saveAttributes

public void saveAttributes(PortletRequest request,
                           ViewCommandExecutionContext executionContext)
Saves the attributes specific to action rendering.

Overrides:
saveAttributes in class StrutsViewCommand
Parameters:
request - the request object
executionContext - the context object

addAttributeNameToSave

public static void addAttributeNameToSave(java.lang.String attributeName)
Adds the name of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase.

Parameters:
attributeName - the name of the attribute

removeAttributeNameToSave

public static void removeAttributeNameToSave(java.lang.String attributeName)
Removes the name of an attribute from the list of attribute names to save.

Parameters:
attributeName - the name of the attribute

addAttributeTypeToSave

public static void addAttributeTypeToSave(java.lang.Class attributeType)
Adds the class type of an attribute from the object request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase.

Parameters:
attributeType - the attribute type

removeAttributeTypeToSave

public static void removeAttributeTypeToSave(java.lang.Class attributeType)
Removes the class type of the request attribute from the list of attributes to save.

Parameters:
attributeType - the attribute type