If you want to update the WebSphere Commerce Struts configuration while the WebSphere Commerce application is running, you can use store publish or update the configuration
directly.
About this task
- Using store publish when you need to propagate custom store configuration to your WebSphere Commerce web application configuration at publish time while the configuration information
remains part of the store archive.
- Updating the Struts configuration directly when you need to make pervasive, site-wide,
store-independent changes to your WebSphere Commerce web application configuration.
Procedure
-
Updating the Struts configuration with store publish
-
Navigate to the WEB-INF/stores/ yourStoreName/data/
subdirectory of your SAR package root directory.
-
Create a struts-config-update.tpl.xml file.
-
Open the store publish control file, ibm-wc-load.xml, and make the
following changes:
- Copy the following asset elements to the end of the asset
definition section:
<asset id="strutsConfigUpdate.template" location="struts-config-update.tpl.xml" />
<asset id="strutsConfigUpdate" location="struts-config-update.xml" />
<asset id="strutsTileConfigUpdate.template" location="tiles-defs-update.tpl.xml" />
<asset id="strutsTileConfigUpdate" location="tiles-defs-update.xml" />
These
elements define the names and locations of your Struts and Tiles input and output configuration
update files.
- Copy the following deploy-task-cmd elements to the end of the
deployment task command definition section:
<deploy-task-cmd name="commandInvoker" class="com.ibm.commerce.tools.devtools.publish.tasks.CommandInvokerTaskCmd"/>
<deploy-task-cmd name="findStore" class="com.ibm.commerce.tools.devtools.publish.tasks.StoreIdBaseDeployTaskCmd"/>
<deploy-task-cmd name="fileFilter"class="com.ibm.commerce.tools.devtools.publish.tasks.unpack.FileFilterTaskCmd"/>
These
elements define the task commands that you refer to in the next step.
- Copy the following task elements to the end of the
target element with id="all":
<!-- This task determines the actual ID for your store, which has been generated earlier in the publish process.
Note that STORE_IDENTIFIER, ORGENTITYNAME, and ORGANIZATION_DN are the entity names defined in the ForeignKeys.dtd file
found in the current directory and might be different for your SAR. -->
<task name="findStore">
<param name="storeIdentifier"value="${asset:foreignKeys#STORE_IDENTIFIER}" />
<param name="organizationDN" value="ou=${asset:foreignKeys#ORGENTITYNAME},${asset:foreignKeys#ORGANIZATION_DN}"/>
<export name="storeEntityId" value="storeEntityId" />
</task>
<!-- This task replaces all the ${storeId} occurrences in your struts-config-update.tpl.xml file with the actual store ID
determined in the preceding substep and creates a struts-config-update.xml file to be used in the following substep. -->
<task name="fileFilter">
<param name="input-filename" value="${asset:strutsConfigUpdate.template}" />
<param name="output-filename" value="${asset:strutsConfigUpdate}" />
<param name="storeId" value="${context:storeEntityId}"/>
</task>
<!-- This task effects the update to the Stores Web module Struts configuration file.
It will make a backup copy of the current version of the Struts configuration file
before replacing it with an updated version. -->
<task name="commandInvoker">
<param name="invoked_commandClassName" value="com.ibm.commerce.struts.commands.UpdateStrutsConfigFileCmd"/>
<param name="webAppName" value="Stores" />
<param name="updateFileName" value="${asset:strutsConfigUpdate}" />
</task>
<!-- This task effects the refresh of the WebSphere Commerce registry. -->
<task name="commandInvoker">
<param name="invoked_commandClassName" value="com.ibm.commerce.scheduler.commands.RefreshRegistryCmd"/>
<param name="URL" value="/ignore" />
</task>
- Save your changes.
-
Publish your store
archive.
-
Updating Struts configuration directly.
-
Edit the WebSphere Commerce Struts custom
configuration files for the appropriate Web modules.
-
Update the registry
component named StrutsConfigRegistry.