Defining a Spring controller

The Business console web application relies on Spring MVC and you might want to use Spring controllers to serve HTTP requests.

By serving HTTP requests with Spring controllers, you are able to package all the custom code (client-side and server-side) on a single JAR to add in the application class path. The application automatically detects your Spring controllers with no additional configuration.

Example

@Controller
public class CustomController {

    @RequestMapping(value = "/ext/custom/data", method = RequestMethod.GET)
    public @ResponseBody
    Map<String, Object> data(@RequestParam(value="branchId", required=false) String branchId) {
        // Your custom code goes here
    }
}

You can still use any request handlers to server HTTP requests such as servlets, but in this case, you have to declare request handlers in the web application descriptor.

A typical implementation of a request handler is first to retrieve the session to start working with the Decision Center API. You can use the following method to retrieve the session:
IlrSession session = ExtUtils.retrieveSession();