Class ResolveContentURLCmdImpl
- java.lang.Object
-
- com.ibm.websphere.command.TargetableCommandImpl
-
- com.ibm.websphere.command.CacheableCommandImpl
-
- com.ibm.commerce.command.MeasuredCacheableCommandImpl
-
- com.ibm.commerce.command.AbstractECTargetableCommand
-
- com.ibm.commerce.command.TaskCommandImpl
-
- com.ibm.commerce.content.commands.ResolveContentURLCmdImpl
-
- All Implemented Interfaces:
- com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, ResolveContentURLCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable
public class ResolveContentURLCmdImpl extends TaskCommandImpl implements ResolveContentURLCmd
The
ResolveContentURLCmdImpl
class provides an implementation of theResolveContentURLCmd
task command that resolves content URLs that are prefixed with the token "http://[cmsHost]". The token is replaced by a URL prefix value that is calculated by appending a configured path value to a configured host value. The configuration values are set in theSTORECONF
table. If the command does not detect the "e;http://[cmsHost]" prefix then the unresolved URL is returned without modification.In addition to resolving the URL, this command will resolve the MIME type of the content. The command will scan the URL for a configured parameter name and use the parameter value as the MIME type. If the parameter is not found, the command will attempt to determine the MIME type from the file extension.
This command uses the following values in the STORECONF table.
wc.resolveContentURL.cmsHost
- The host name (including the scheme, host name, and port) of the location of production content.wc.resolveContentURL.cmsInternalHost
- The host name (including the scheme, host name, and port) of the location of production content that is accessed from the WebSphere Commerce application server rather than the browser. If this value is not specified, then the value ofwc.resolveContentURL.cmsHost
is used.wc.resolveContentURL.cmsPreviewHost
- The host name (including the scheme, host name, and port) of the location of preview content. If this value is not specified, then the value ofwc.resolveContentURL.cmsHost
is used.wc.resolveContentURL.cmsInternalPreviewHost
- The host name (including the scheme, host name, and port) of the location of preview content that is accessed from the WebSphere Commerce application server rather than the browser. If this value is not specified, then the command will look for a value by first checkingwc.resolveContentURL.cmsPreviewHost
, thenwc.resolveContentURL.cmsInternalHost
and thenwc.resolveContentURL.cmsHost
.wc.resolveContentURL.cmsPath
- The path to the production location of content. This value is optional and can be omitted if the content URLs are relative to the content host.wc.resolveContentURL.cmsPreviewPath
- The path to the preview location of content. If this value is not specified, then the value ofwc.resolveContentURL.cmsPath
is used.wc.resolveContentURL.useRelativeURLs
- Indicates that this the command will use relative URLs when resolving production URLs. Set this value totrue
if content URLs are relative to the same host name as the pages that include them. This option can be overridden by setting theincludeHostName
property totrue
.wc.resolveContentURL.mimeTypeParameter
- The name of a parameter in the URL that indicates the MIME type. If this value is not specified, then the default value ofmimeType
is used.
wc.resolveContentURL.renderTypeParameter
- The name of a parameter in the URL that indicates how the content is to be rendered. If this value is not specified, then the default value ofrenderType
is used.
wc.resolveContentURL.contentRenderType
- The value of therenderType
parameter that indicates that the content is an HTML fragment that is to be embedded in a page. If not specified, the default value isCONTENT
.wc.resolveContentURL.linkRenderType
- The value of therenderType
parameter that indicates that the content URL is to be rendered as link using the HTML anchor (A) tag. If not specified, the default value isLINK
.wc.resolveContentURL.resourceRenderType
- The value of therenderType
parameter that indicates that the content URL is an image or other resource and is to be rendered in HTML according to themimeType
value. If not specified, the default value isRESOURCE
.wc.resolveContentURL.encode
- Indicates that the content URL value is to be URL encoded before being appended to the configured path. Set this value totrue
if content URLs should be URL encoded andfalse
if the URLs should not be encoded. If this value is not specified, then the content URL is not encoded.wc.resolveContentURL.encodeForPreview
- Indicates that preview URLs are to be resolved by URL encoding the content URL before being appending it to the configured path. Set this value totrue
if preview content URLs should be URL encoded andfalse
if the URLs should not be encoded. If this value is not specified, then the value ofwc.resolveContentURL.encode
is used.wc.resolveContentURL.getResourceURL
- Indicates that URLs that have a render type of RESOURCE are to be retrieved from the resolved content URL. Set this value totrue
to indicate that resource URLs are to be retrieved from the content URL. If this value is not specified, then the resolved URL is treated as the resource URL.wc.resolveContentURL.getPreviewResourceURL
- Indicates that preview URLs that have a render type of RESOURCE are to be retrieved from the resolved content URL. Set this value totrue
to indicate that preview resource URLs are to be retrieved from the content URL. If this value is not specified, then the value ofwc.resolveContentURL.getResourceURL
is used.wc.resolveContentURL.getLinkURL
- Indicates that URLs that have a render type of LINK are to be retrieved from the resolved content URL. Set this value totrue
to indicate that link URLs are to be retrieved from the content URL. If this value is not specified, then the resolved URL is treated as the link URL.wc.resolveContentURL.getPreviewLinkURL
- Indicates that preview URLs that have a render type of LINK are to be retrieved from the resolved content URL. Set this value totrue
to indicate that preview link URLs are to be retrieved from the content URL. If this value is not specified, then the value ofwc.resolveContentURL.getLinkURL
is used.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.ibm.commerce.content.commands.ResolveContentURLCmd
defaultCommandClassName, NAME
-
Constructor Summary
Constructors
Constructor and Description
ResolveContentURLCmdImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
java.lang.String
getResolvedMimeSubtype()
Get the resolved MIME content sub-type.
java.lang.String
getResolvedMimeType()
Get the resolved MIME content type.
java.lang.String
getResolvedRenderType()
Get the resolved render type.
java.lang.String
getResolvedURL()
Get the resolved content URL.
void
performExecute()
This method performs the business logic for this command.
void
setIncludeHostName(boolean includeHostName)
Indicates that the content URL must be a fully qualified URL that includes the scheme,
host name and port.
void
setInternal(boolean internal)
Indicates that the content URL is to be resolved for an internal
call from the WebSphere Commerce application server.
void
setPreview(boolean preview)
Indicates that the content URL is to be resolved to the preview location.
void
setStoreStaticAssets(boolean storeStaticAssets)
Indicates that the content URL is to be resolved for getting store static
assets from Content Management System.
void
setUnresolvedURL(java.lang.String unresolvedURL)
Set the unresolved content URL.
void
setUseCustomerTenantWCH(boolean useCustomerTenantWCH)
Indicates that the content URL is to be resolved will point to customer
tenant in WCH instead of default IBM tenant.
-
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
-
Methods inherited from class com.ibm.websphere.command.CacheableCommandImpl
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
-
Methods inherited from class com.ibm.websphere.command.TargetableCommandImpl
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.websphere.command.CacheableCommand
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
-
Methods inherited from interface com.ibm.websphere.command.TargetableCommand
getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputProperties
-
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
-
-
Method Detail
-
setUnresolvedURL
public void setUnresolvedURL(java.lang.String unresolvedURL)
Set the unresolved content URL. This value must be set before the command is executed.
- Specified by:
setUnresolvedURL
in interface ResolveContentURLCmd
- Parameters:
unresolvedUrl
- unresolved content URL
- See Also:
ResolveContentURLCmd.setUnresolvedURL(java.lang.String)
-
setStoreStaticAssets
public void setStoreStaticAssets(boolean storeStaticAssets)
Indicates that the content URL is to be resolved for getting store static
assets from Content Management System. If true, the URL will be constructed
by using CMS_STATIC_CONTENT_HOST_KEY and CMS_PREVIEW_PATH_KEY.
Set to false if the URL is intended for other usage.
The default is false
- Specified by:
setStoreStaticAssets
in interface ResolveContentURLCmd
- Parameters:
internal
- internal URL option
-
setUseCustomerTenantWCH
public void setUseCustomerTenantWCH(boolean useCustomerTenantWCH)
Indicates that the content URL is to be resolved will point to customer
tenant in WCH instead of default IBM tenant.
- Specified by:
setUseCustomerTenantWCH
in interface ResolveContentURLCmd
-
setInternal
public void setInternal(boolean internal)
Indicates that the content URL is to be resolved for an internal
call from the WebSphere Commerce application server.
Set to false if the URL is intended for use within the browser.
The default is false
- Specified by:
setInternal
in interface ResolveContentURLCmd
- Parameters:
internal
- internal URL option
-
setPreview
public void setPreview(boolean preview)
Indicates that the content URL is to be resolved to the preview location.
Set to false for production URLs. The default is false
.
- Specified by:
setPreview
in interface ResolveContentURLCmd
- Parameters:
preview
- preview option
-
setIncludeHostName
public void setIncludeHostName(boolean includeHostName)
Indicates that the content URL must be a fully qualified URL that includes the scheme,
host name and port. The command will prepare relative URLs
if internal
and preview
are set to false and the
wc.resolveContentURL.useRelativeURLs
configuration value is set to true
.
Set this property to true
to force the URLs to be
fully qualified with the configured host name. For example, if the URL is intended for inclusion in an e-mail, then
it must be fully qualified. The default is false
.
- Specified by:
setIncludeHostName
in interface ResolveContentURLCmd
- Parameters:
includeHostName
- includeHostName option
-
getResolvedURL
public java.lang.String getResolvedURL()
Get the resolved content URL. This value is available after the command is executed.
- Specified by:
getResolvedURL
in interface ResolveContentURLCmd
- Returns:
- the resolved content URL
-
getResolvedMimeType
public java.lang.String getResolvedMimeType()
Get the resolved MIME content type. This value is available after the command is executed.
- Specified by:
getResolvedMimeType
in interface ResolveContentURLCmd
- Returns:
- the resolved MIME content type
-
getResolvedMimeSubtype
public java.lang.String getResolvedMimeSubtype()
Get the resolved MIME content sub-type. This value is available after the command is executed.
- Specified by:
getResolvedMimeSubtype
in interface ResolveContentURLCmd
- Returns:
- the resolved MIME content sub-type
-
getResolvedRenderType
public java.lang.String getResolvedRenderType()
Get the resolved render type. This value is available after the command is executed.
The value can be CONTENT, LINK or RESOURCE.
A value of CONTENT indicates that the content is an HTML fragment that is
to be embedded in an HTML page.
A value of LINK indicates that the content is a stand alone HTML page and that
the content URL is to be rendered as a link to that page using the HTML anchor (A) tag.
A value of RESOURCE indicates that the content is an image or other type of file
and that the content URL is to be rendered according to the MIME type.
- Specified by:
getResolvedRenderType
in interface ResolveContentURLCmd
- Returns:
- the resolved render type
-
performExecute
public void performExecute()
throws ECException
This method performs the business logic for this command.
- Specified by:
performExecute
in interface ECCommand
- Specified by:
performExecute
in interface com.ibm.websphere.command.TargetableCommand
- Overrides:
performExecute
in class AbstractECTargetableCommand
- Throws:
ECException
- An exception is thrown if there are errors while resolving the content URL