Updating the Web application configuration

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
    1. Navigate to the WEB-INF/stores/ yourStoreName/data/ subdirectory of your SAR package root directory.
    2. Create a struts-config-update.tpl.xml file.
      • Follow the same schema and general structure as the Store module primary Struts configuration file, struts-config.xml file. Refer to the struts-config-update.tpl.xml files provided as part of the WebSphere Commerce starter store SAR packages for examples.
      • Instead of inserting the actual store ID for your store, use the ${storeId} substitution variable. The following code snippet shows an example for this substitution.
        
        <forward className="com.ibm.commerce.struts.ECActionForward" name="AddressBookForm/${storeId}" 
         path="/UserArea/AccountSection/AddressbookSubsection/AddressBookForm.jsp"/>
        <set-property property="authenticate" value="${storeId}:1" />
    3. Open the store publish control file, ibm-wc-load.xml, and make the following changes:
      1. 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.
      2. 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.

      3. 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>
      4. Save your changes.
      5. Publish your store archive.
  • Updating Struts configuration directly.
    1. Edit the WebSphere Commerce Struts custom configuration files for the appropriate Web modules.
    2. Update the registry component named StrutsConfigRegistry.