Resolving content URLs to an external system

When is integrated with an external content management system, URLs for content in the external system can be resolved by using the wcst:resolveContentURL tag.

URL references or links to content in an external content management system might not be fully qualified, or resolved, URLs. These URLs can contain one or more tokens, such as the host name for the external system. These tokens can be resolved differently in an authoring environment than in a production environment.

The wcst:resolveContentURL JSTL tag is used to convert the URL to an external system. The tag converts the URL to a URL that is valid for the current environment and for the context where the retrieved content is being used. If the specified unresolved URL cannot be resolved as a content URL, then the specified URL path is returned unchanged. This tag is used by the store pages where the retrieved content is being rendered. This tag can also be used when a punch-out integration with an external content management system is not enabled.

When this tag is included on a store page to resolve content URLs from an external system, the following attributes can be defined for the wcst:resolveContentURL tag.
  • url - the URL of the content that is being resolved. The unresolved URL can be specified with this attribute or in the body of the wcst:resolveContentURL tag.
  • var - the variable to which the resolved content URL is assigned. If this variable attribute is not specified, the resolved content URL is written to the current JSPWriter.
  • mimeTypeVar - the variable to which the resolved MIME content type is assigned.
  • mimeSubtypeVar - the variable to which the resolved MIME content subtype is assigned.
  • renderTypeVar - the variable to which the resolved render type is assigned.
  • includeHostName - indicates that the host name is to be included within the resolved URL. Specify true to include the host name. The default value is false.
  • scope - the scope for the variables that are specified with the var, mimeTypeVar, mimeSubtypeVar, and renderTypeVar attributes. The values for the scope attribute can be page, request, session, and application. The default value is page.

Any unresolved content URLs must have the http://[cmsHost] prefix token. These unresolved URLs are then resolved with the com.ibm.commerce.content.commands.ResolveContentURLCmd task command. The default implementation of the task command replaces the token with a URL prefix value. This value is determined by appending a configured path value to a configured host name. For more information about configuring the default implementation of this task command, see com.ibm.commerce.content.commands.ResolveContentURLCmdImpl.

The content URL is resolved from the specified attachment asset path and stored in the variable named content URL.
<wcst:resolveContentURL var="contentURL" url="${attachment.attachmentAsset[assetIndex].attachmentAssetPath}"/>
The URLs are store with the following format, http://[cmsHost]/contentPath. The resolveContentURL tag replaces the http:/[cmsHost] prefix with the host name and path for the external system that is configured in the STORECONF database table.