com.ibm.portal.struts.command
Class StrutsViewStaticCommand

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

public class StrutsViewStaticCommand
extends StrutsFilteredViewCommand

The StrutsViewStaticCommand class is a command pattern class used to provide a mechanism to encapsulate the information needed to redisplay a view. This particular subclass deals with HTML pages, or any page which is static content and is simply placed in the output buffer as is.

Since:
5.1
See Also:
Serialized Form

Field Summary
protected static java.util.List EMPTY_LIST
           
static java.lang.String HOME_FORWARD_NAME
          The forward name we look for to indicate the path for a home button on static content
protected static MessageResources messages
          The message resources for the Struts Portlet Framework.
protected static java.lang.String URI
           
 
Fields inherited from class com.ibm.portal.struts.command.StrutsFilteredViewCommand
wpsStrutsTranscodingRequestWrapper
 
Fields inherited from class com.ibm.portal.struts.command.StrutsViewCommand
CONTENT_TYPE, PREFIX
 
Constructor Summary
StrutsViewStaticCommand(java.lang.String uri, PortletRequest request)
          Construct the StrutsViewStaticCommand command
 
Method Summary
static void addAttributeNameToSave(java.lang.String attributeName)
          Add 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
 void executeCommand(RenderRequest request, RenderResponse response, ViewCommandExecutionContext executionContext)
          Execute the given command given the request and response objects
 java.lang.String fixupAbsolutePath(java.lang.String path)
          Convert URLs of the form http://www.ibm.com to http://www.ibm.com/ .
protected  java.lang.String getCharsetFromContentType(java.lang.String contentType)
          Extract the charset from the Content-Type string, or return a default if unavailable.
 java.lang.String getURI(RenderRequest request)
          Return the URI string
 void saveAttributes(PortletRequest request, ViewCommandExecutionContext executionContext)
          Save the attributes specific to JSP rendering.
 void setURI(PortletRequest request, java.lang.String uri)
          Set the uri
protected  void writeReaderToWriter(java.io.Reader reader, java.io.Writer writer)
          Write the contents of a Reader to a Writer.
 
Methods inherited from class com.ibm.portal.struts.command.StrutsFilteredViewCommand
execute, isDebugOn, trace
 
Methods inherited from class com.ibm.portal.struts.command.StrutsViewCommand
addAttribute, addAttributeTypeToSave, getContentType, getPrefix, getRemoveOnModeChange, getSavedAttributes, getSavedCommand, removeAttribute, removeAttributeNameToSave, removeAttributeTypeToSave, 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

EMPTY_LIST

protected static final java.util.List EMPTY_LIST

HOME_FORWARD_NAME

public static final java.lang.String HOME_FORWARD_NAME
The forward name we look for to indicate the path for a home button on static content

See Also:
Constant Field Values

URI

protected static final java.lang.String URI
See Also:
Constant Field Values

messages

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

Constructor Detail

StrutsViewStaticCommand

public StrutsViewStaticCommand(java.lang.String uri,
                               PortletRequest request)
Construct the StrutsViewStaticCommand command

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

getURI

public java.lang.String getURI(RenderRequest request)
Return the URI string

Parameters:
request - The request providing the context to fetch the URI.
Returns:
uri string

setURI

public void setURI(PortletRequest request,
                   java.lang.String uri)
Set the uri

Parameters:
request - the portlet request object.
uri - the uri to set.

executeCommand

public void executeCommand(RenderRequest request,
                           RenderResponse response,
                           ViewCommandExecutionContext executionContext)
                    throws PortletException
Execute the given command given the request and response objects

Specified by:
executeCommand in class StrutsFilteredViewCommand
Parameters:
request - The request object
response - The response object
executionContext - the execution context object
Throws:
PortletException

writeReaderToWriter

protected void writeReaderToWriter(java.io.Reader reader,
                                   java.io.Writer writer)
                            throws java.io.IOException
Write the contents of a Reader to a Writer.

Parameters:
reader - The source Reader.
writer - The destination Writer.
Throws:
java.io.IOException - On IO error.

getCharsetFromContentType

protected java.lang.String getCharsetFromContentType(java.lang.String contentType)
Extract the charset from the Content-Type string, or return a default if unavailable.

Parameters:
contentType - The Content-Type HTTP response header to parse.
Returns:
The charset, or UTF-8 if unavailable.

addAttributeNameToSave

public static void addAttributeNameToSave(java.lang.String attributeName)
Add 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

saveAttributes

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

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

fixupAbsolutePath

public java.lang.String fixupAbsolutePath(java.lang.String path)
Convert URLs of the form http://www.ibm.com to http://www.ibm.com/ . This is necessary to fix a problem in the base code which interprets the base URL for http://www.ibm.com as http://.

Parameters:
path - The URL to fix up
Returns:
The fixed up URL. If it doesn't need fixing up, the original is returned.