Spring MVC and store controller customization

The model-view-controller (MVC) framework used for the store is Spring. Spring is popular, supported, and easy to adopt by developers with previous Struts and WebSphere Commerce experience. The following information details the store Spring MVC implementation, and details on how to customize actions and views. After customizations are made, respective modifications need to be made to the REST template configurations.

For more information about the Spring framework and its API, see:

The store server implements three controllers to fulfill its functions:


Store MVC customization

Since most business logic is handled by the transaction server through REST, extension of methods within the RESTActionController class allows for information to be properly handled and passed on by the store server. The REST Action controller does the following to communicate with the Transaction server:

  1. Resolves the input parameter which includes decryption of the krypto parameter, and parameter validations.

  2. Converts the input parameter into the REST URL and the JSON string using the REST template.

  3. Calls the REST API with that REST URL and JSON string.

  4. Processes the response of the REST API, and return to the appropriate view.


Action controllers

Figure 1.

The following example is a URL to controller mapping in the workspace_dir/crs-web/WebContent/WEB-INF/spring/controllers.xml file:

Note: If store specific customization is needed, a store alias postfix can be used. For example:

<prop key="/Logon/AuroraStorefrontAssetStore">mylogon</prop>

Where the alias is the store directory name as it is set in the database.

Figure 2. The following example is an action controller bean definition in the workspace_dir/crs-web/WebContent/WEB-INF/spring/member-controllers.xml file:

Each default action controller is of class RESTActionController or its extension (such as LogonController), and each action calls one REST service for processing business logic. The following HTTP request properties are supported by actions:


View controllers

Figure 3. The following example is a URL to a view controller mapping in the controllers.xml file:

Figure 4.

The following example is a view controller bean definition in the workspace_dir/crs-web/WebContent/WEB-INF/spring/order-views.xml file:

The additional property elements are the HTTP request properties for this view. The following HTTP request properties are supported by views:


Related tasks
Customizing the store Spring MVC configuration


Related reference
Store configuration files