Introduced in Feature Pack 1

Struts configuration for specifying Atom feed formatting JSP files

The RESTful framework provides Struts configuration files to specify which JSP files to use to format Atom feeds for WebSphere Commerce Web services. The Struts configuration files map feed formatting JSP files to nouns and verbs.

Feed formatting JSP files are registered in the Struts configuration files using action mappings. There are two Struts configuration files:
File Description

Default Struts configuration file:

WebSphere Commerce DeveloperWCDE_installdir/workspace/Rest/WebContent/WEB-INF/struts-config.xml

Do not edit this default Struts configuration file. This file contains the default action mappings for the feed formatting JSP files. All action mappings in this file apply at the site level.

Struts configuration file for customization:

WebSphere Commerce DeveloperWCDE_installdir/workspace/Rest/WebContent/WEB-INF/struts-extension.xml

Make any customization changes to this file. Any action mappings you add to this file will override the action mappings in the default Struts configuration file. For example, you must add action mappings to this file to:
  • Specify a new custom feed formatting JSP file
  • Specify a new location for a feed formatting JSP file
  • Specify a feed formatting JSP file for a specific store, if it is different from the site-level JSP file

For each feed formatting JSP file (or set of files), you can specify whether to use the file (or set) for a specific noun at:

  • The site level: in this case, the value of the storeId variable in the action mapping must be 0.
  • The asset store level: in this case, the value of the storeId variable in the action mapping is the asset store's ID. The JSP file will apply to all sites extending from this asset store.
  • The store level: in this case, the value of the storeId variable in the action mapping is the specific store's ID.

When converting an SDO to an Atom feed, the JAX-RS provider Java class checks the Struts configuration files for the correct JSP page mappings, first at the store level, then at the asset store level, and finally at the site level. The first mapping found is used to format the feed content. This allows you to specify a different feed formatting JSP file to use for a specific asset store or extended site, if you do not want to use the default site-level JSP file.

Format of action mappings

The action mapping for each feed formatting JSP file must use the following syntax:

<action 
     path="/dataAreaType_with_VerbAtom/storeId" 
     forward="/path_to_feed_jsp_file.jsp" />

The variables are:

dataAreaType_with_Verb
The name of the data type Java class for the noun, beginning with the verb, for example, ShowCatalogGroupDataAreaType. See the WebSphere Commerce API documentation for a list of a data type Java classes for a component. For example, for the Catalog component, see Catalog facade data types.
Note: You must include the word Atom after the dataAreaType_with_Verb variable, for example:
ShowCatalogGroupDataAreaTypeAtom
storeId
The ID of your store. If this is a site-level feed formatting JSP file, the storeID value must be 0. You must provide one site-level feed formatting JSP that will be used as the default for your site. Optionally, you can provide additional feed formatting JSP files for asset stores or specific stores.
path_to_feed_jsp_file
The path to the feed formatting JSP file relative to the WCDE_installdir/workspace/Rest/WebContent/ directory.

For example, if the JSP file is stored at WCDE_installdir/workspace/Rest/WebContent/atom/Madisons/SerializeCatalogGroupMadisonsAtom.jsp, then use:

forward="/atom/Madisons/SerializeCatalogGroupMadisonsAtom.jsp"

The following example is a Struts configuration file containing action mappings for two custom feed formatting JSP files that format SDOs for the ShowCatalogGroupDataAreaType data type Java class. The first action mapping is for a site-level JSP file, so the storeId value is 0. The second action mapping is specifically for the Madisons store, which has a storeId of 10101.

<struts-config>
    <action-mappings type="com.ibm.commerce.foundation.rest.struts.ECRestActionMapping">
        <action path="/ShowCatalogGroupDataAreaTypeAtom/0"
forward="/atom/site/SerializeCatalogGroupSiteAtom.jsp"/>
        <action path="/ShowCatalogGroupDataAreaTypeAtom/10101"
forward="/atom/Madisons/SerializeCatalogGroupMadisonsAtom.jsp"/>
</struts-config>