com.ibm.portal.struts.command
Class StrutsViewJspCommand

java.lang.Object
  extended by com.ibm.portal.struts.command.StrutsViewCommand
      extended by com.ibm.portal.struts.command.StrutsViewJspCommand
All Implemented Interfaces:
IViewCommand, java.io.Serializable
Direct Known Subclasses:
StrutsViewTilesCommand

public class StrutsViewJspCommand
extends StrutsViewCommand

Command pattern class which provides a mechanism to encapsulate the information needed to redisplay a view for dynamic content like JSPs.

Since:
5.1
See Also:
Serialized Form

Field Summary
protected static java.lang.String QUERY
          Name of the request attribute for the query string.
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, messages, PREFIX
 
Constructor Summary
StrutsViewJspCommand()
          Default construtor.
StrutsViewJspCommand(java.lang.String uri, PortletRequest request)
          Constructs the view command.
 
Method Summary
static void addAttributeNameToSave(java.lang.String attributeName)
          Adds the name of an attribute from the object request the 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 request that needs to be saved if present for the execution of the IViewCommand in Portal's render phase.
protected  void addQueryParameters(java.lang.String query, PortletRequest request)
          Adds the query parameters to the request object.
 void execute(RenderRequest request, RenderResponse response, ViewCommandExecutionContext executionContext)
          Executes the given command given the request and response objects.
 java.lang.String getQueryString(PortletRequest request)
          Returns the query string.
 java.lang.String getUri(PortletRequest request)
          Returns the URI.
protected  void includeURL(java.lang.String uri, RenderRequest request, RenderResponse response, ViewCommandExecutionContext executionContext)
          Includes the URL.
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 JSP rendering.
 void setQueryString(PortletRequest request, java.lang.String query)
          Sets the query string.
 void setUri(PortletRequest request, java.lang.String uri)
          Sets the URI.
 
Methods inherited from class com.ibm.portal.struts.command.StrutsViewCommand
addAttribute, getContentType, getPrefix, getRemoveOnModeChange, getSavedAttributes, getSavedCommand, removeAttribute, repopulateRequest, saveAsAttribute, saveAttribute, saveAttributes, saveCommand, 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

QUERY

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

See Also:
Constant Field Values
Constructor Detail

StrutsViewJspCommand

public StrutsViewJspCommand()
Default construtor. Should set the URI using the method setURI if this constructor is used.


StrutsViewJspCommand

public StrutsViewJspCommand(java.lang.String uri,
                            PortletRequest request)
Constructs the view command. The URI will be a path to a JSP file. Typically, the configured ViewCommandFactory will make the determination that the URI is for a JSP file.

Parameters:
uri - the uri path to the JSP
request - The request object to save context information from
Method Detail

execute

public void execute(RenderRequest request,
                    RenderResponse response,
                    ViewCommandExecutionContext executionContext)
             throws PortletException
Executes the given command given the request and response objects.

Specified by:
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

includeURL

protected void includeURL(java.lang.String uri,
                          RenderRequest request,
                          RenderResponse response,
                          ViewCommandExecutionContext executionContext)
                   throws PortletException
Includes the URL.

Parameters:
uri - the URI to include
request - the request object
response - the reponse object
executionContext - the execution context
Throws:
PortletException - if file can not be included

addQueryParameters

protected void addQueryParameters(java.lang.String query,
                                  PortletRequest request)
Adds the query parameters to the request object. Expects the query parameters in the form ?param=valu

Parameters:
query - the query string
request - the request object

saveAttributes

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

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

getQueryString

public java.lang.String getQueryString(PortletRequest request)
Returns the query string.

Parameters:
request - the portlet request object
Returns:
returns the query string

setQueryString

public void setQueryString(PortletRequest request,
                           java.lang.String query)
Sets the query string.

Parameters:
request - the portlet request object
query - the query string

getUri

public java.lang.String getUri(PortletRequest request)
Returns the URI. The URI will be the path to a JSP file.

Parameters:
request - the portlet request object
Returns:
returns the saved uri, can be null

setUri

public void setUri(PortletRequest request,
                   java.lang.String uri)
Sets the URI. The URI will be a path to a JSP file. Typically, the configured ViewCommandFactory will make the determination that the URI is for a JSP file.

Parameters:
request - the portlet request object
uri - the uri

addAttributeNameToSave

public static void addAttributeNameToSave(java.lang.String attributeName)
Adds the name of an attribute from the object request the 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 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