public class GetContentCmdImpl extends TaskCommandImpl implements GetContentCmd, com.ibm.websphere.cache.Sizeable
The GetContentCmdImpl class provides an implementation of the
GetContentCmd task command that retrieves content from the
specified content URL. The URL must be accessible from the WebSphere
Commerce application server and the content must be text or HTML that
can be included in the page that is returned to the browser.
If the content includes embedded URLs, then the URLs must be:
This command can be configured by setting the following values in the STORECONF table:
wc.getContent.connectTimeout - The number of milliseconds allowed before the connection times out.
This value is used when production content is retrieved. The default is 3000.wc.getContent.previewConnectTimeout - The number of milliseconds allowed before the connection times out.
This value is used when preview content is retrieved. If this value is not specified, then the value of
wc.getContent.connectTimeout is used.wc.getContent.readTimeout - The number of milliseconds allowed before the read times out.
This value is used when production content is retrieved. The default is 3000.wc.getContent.previewReadTimeout - The number of milliseconds allowed before the read times out.
This value is used when preview content is retrieved. If this value is not specified, then the value of
wc.getContent.readTimeout is used.wc.getContent.cmsToken - A prefix token that will be found in the embedded URLs in production content.
The token will be replaced by a configurable URL prefix. The replacement URL prefix is calculated by appending a
configurable content path to a configurable content host. If this value is not specified, then embedded URLs will not be
modified.wc.getContent.cmsPreviewToken - A prefix token that will be found in the embedded URLs in preview content.
The token will be replaced by a configurable URL prefix. The replacement URL prefix is calculated by appending a
configurable content path to a configurable content host. If this value is not specified, the value of
wc.getContent.cmsToken is used.wc.getContent.cmsHost - The host name (including the scheme, host name, and port) of the location of production
content. This value (along with the path) is used to replace the prefix token found in embedded URLs in the content.wc.getContent.cmsPreviewHost - The host name (including the scheme, host name, and port) of the location of preview
content. This value (along with the path) is used to replace the prefix token found in embedded URLs in the content.wc.getContent.cmsPath - The path to the production location of content.
This value (along with the host) is used to replace the prefix token found in embedded URLs in the content.wc.getContent.cmsPreviewPath - The path to the preview location of content.
This value (along with the path) is used to replace the prefix token found in embedded URLs in the content.wc.getContent.useRelativeURLs - Indicates that relative URLs are used when replacing embedded
content URLs found in the retrieved production content. Set this value to true if embedded content URLs are relative
to the same host name as the pages that include them. This option can be overridden by setting the includeHostName
property to true.wc.getContent.characterEncoding - The character encoding of the content. The default is UTF-8.wc.getContent.sendLTPAToken - Indicates that this command will send the LTPA token when retrieving content from the URL.
Set this value to true to indicate that the LTPA token should be sent when retrieving content. Set to false
to indicate that the LTPA token should not be sent. The default is false.wc.getContent.sendPreviewLTPAToken - Indicates that this command will send the LTPA token when retrieving preview content from the URL.
Set this value to true to indicate that the LTPA token should be sent when retrieving preview content. Set to false
to indicate that the LTPA token should not be sent. If this value is not specified, then the value of wc.getContent.sendLTPAToken is used.wc.getContent.ltpaTokenDomain - The domain for the LTPA token. If the host name of the content URL matches this
domain, then the LTPA token is sent with the request. If this value is not specified, then the LTPA token is sent to all domains.wc.getContent.previewLTPATokenDomain - The domain for the preview LTPA token. If the host name of the preview content URL matches this
domain, then the LTPA token is sent with the request. If this value is not specified, then the value of wc.getContent.ltpaTokenDomain is used.wc.getContent.ltpaTokenSecure - The secure connection setting for sending the LTPA token. If this value is set to true,
then the LTPA token will only be sent to the content URL if it is a secure connection. The default value is false.wc.getContent.previewLTPATokenSecure - The secure connection setting for sending the preview LTPA token. If this value is set to
true, then the preview LTPA token will only be sent to the preview content URL if it is a secure connection. If this value is not
specified, then the value of wc.getContent.ltpaTokenSecure is used.If the content cannot be retrieved, a warning is logged and the content property is set to null.
This command is a cacheable command. The following cachespec entry will enable this command.
<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.commerce.content.commands.GetContentCmdImpl</name>
<cache-id>
<component type="method" id="getCacheId">
<required>true</required>
</component>
<priority>1</priority>
<timeout>3600</timeout>
<inactivity>600</inactivity>
</cache-id>
<dependency-id>getContent</dependency-id>
</cache-entry>
defaultCommandClassName, NAME| Constructor and Description |
|---|
GetContentCmdImpl() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCacheId()
Generate a cache ID for use with dynacache.
|
java.lang.String |
getContent()
Get the content.
|
boolean |
getIncludeHostName()
Get the includeHostName option.
|
long |
getObjectSize()
Returns the estimated footprint size in bytes
of this object and the objects it contains.
|
boolean |
getPreview()
Get the preview option.
|
java.lang.String |
getURL()
Get the content URL.
|
void |
performExecute()
This method performs the business logic for this command.
|
void |
setIncludeHostName(boolean includeHostName)
Indicates that the URLs embedded in the content must be a fully qualified URLs that includes the scheme,
host name and port.
|
void |
setOutputProperties(com.ibm.websphere.command.TargetableCommand cachedCommand)
Copy the content from a cached version of this command.
|
void |
setPreview(boolean preview)
Indicates that the content is preview content.
|
void |
setURL(java.lang.String url)
Set the content URL.
|
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParametersexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCachegetCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setTargetPolicyequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCachegetCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetNamecheckIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameterspublic void setURL(java.lang.String url)
setURL in interface GetContentCmdurl - content URLGetContentCmd.setURL(java.lang.String)public java.lang.String getURL()
public java.lang.String getContent()
getContent in interface GetContentCmdpublic void setPreview(boolean preview)
false.setPreview in interface GetContentCmdpreview - preview optionpublic boolean getPreview()
public void setIncludeHostName(boolean includeHostName)
preview is set to false and the
wc.getContent.useRelativeURLs configuration value is set to true.
Set this property to true to force the embedded content URLs to be
fully qualified with the configured host name. For example, if the content is intended for inclusion in an e-mail, then
the embedded URLs must be fully qualified. The default is false.setIncludeHostName in interface GetContentCmdincludeHostName - includeHostName optionpublic boolean getIncludeHostName()
public void performExecute()
throws ECException
performExecute in interface ECCommandperformExecute in interface com.ibm.websphere.command.TargetableCommandperformExecute in class AbstractECTargetableCommandECException - An exception is thrown if there are errors while resolving the content URLpublic long getObjectSize()
getObjectSize in interface com.ibm.websphere.cache.SizeablegetObjectSize in class AbstractECTargetableCommandpublic void setOutputProperties(com.ibm.websphere.command.TargetableCommand cachedCommand)
setOutputProperties in interface com.ibm.websphere.command.TargetableCommandsetOutputProperties in class com.ibm.websphere.command.TargetableCommandImplcachedCommand - the cached version of this commandTargetableCommandImpl.setOutputProperties(com.ibm.websphere.command.TargetableCommand)public java.lang.String getCacheId()