Mapping URLs to controller commands: action-mappings

Associating a URL with a controller command interface is accomplished in the WebSphere Commerce web application with action-mappings elements. In earlier versions of WebSphere Commerce, you associated a URL with a controller command interface by using the URLREG database table.

About this task

Consider the three associations that are represented in the following table:

URL Store ID Controller command interface HTTPS Authenticate Credentials Accepted
StoreCatalogDisplay 0 com.ibm.commerce. catalog.commands. StoreCatalogDisplayCmd 0 0 NULL
AddressAdd 0 com.ibm.commerce. usermanagement.commands. AddressAddCmd 0 0 NULL
AddressAdd 201 com.ibm.commerce. usermanagement.commands. AddressAddCmd 1 1 P

Where:

URL
The URL name.
Store ID
The store reference number for this URI or 0 to mean any store.
HTTPS
The value of 1 indicates that the request was expected to be received on a secure channel (HTTPS) and a redirect to the SSL port is issued if it is received on an insecure channel (HTTP).
Note: When you make an Ajax request and the type is set to be com.ibm.commerce.struts.AjaxComponentServiceAction, the HTTPS setting does not take effect. Instead, the scheme that is used by the parent page takes effect. For example, if the ProductDisplay page is rendered with HTTP, then making an Ajax request to add an item to the shopping cart with AjaxOrderChangeServiceItemAdd, the Ajax request uses HTTP to make the request. This HTTP request occurs regardless of the HTTPS setting for AjaxOrderChangeServiceItemAdd in the struts configuration file.
Authenticate
The value of 1 indicates that user logon is required for this URI. Only non-guest, non-generic users are allowed to access pages with Authenticate=1.
Credentials Accepted
The value of P indicates that partially authenticated users are entitled to access this resource. Partially authenticated users are those users that are logged off, but in a remembered user state. That is, when rememberMe is set to true for the Logoff command.

The following action-mappings configuration element describes these associations:


<action-mappings type="com.ibm.commerce.struts.ECActionMapping">         
  <action path="/StoreCatalogDisplay" parameter="com.ibm.commerce.catalog.commands.StoreCatalogDisplayCmd" 
   type="com.ibm.commerce.struts.BaseAction" />
  <action path="/AddressAdd"  parameter="com.ibm.commerce.usermanagement.commands.AddressAddCmd"  
   type="com.ibm.commerce.struts.BaseAction"> 
  <set-property property="https" value="0:0,201:1" /> 
  <set-property property="authenticate" value="201:1" /> 
  <set-property property="credentialsAccepted" value="201:P" /> 
  </action>
</action-mappings>

Note in particular:

  • The use of the parameter attribute of the action element to specify the name of the interface of the controller command to invoke.
  • The values of the type attributes.
  • The syntax of the value attribute of the nested set-property element: a comma-separated list of storeID : propertyValue pairs that defaults to 0:0.