This page provides a high-level overview of how this framework maps the concepts of REST to Spring MVC. It also describes, in general terms, how the framework works and how to use it. The reader is assumed to have a working understanding of both REST and Spring MVC .
There are 4 major concepts in REST: Resources, Resource Identifiers, Operations, Request Representations, and Response Representations. The following sections describe each of these concepts and their relationship to this framework.
Resources are a central concept in REST. All entities (or sets of entities) are modeled as resources and all interactions involve accessing or manipulating resources.
In this framework, resources are the business objects of the application. This framework does not provide any facilities for building resources. Instead, its focus is on exposing resources.
For example, a resource could be one or more rows in a database table. Users of this framework would need to supply the database and a DAO to get the row(s) from the database.
All resources in REST are identified by a URI . Because of the dynamic nature of many resources, these URIs are often represented as parameterized URI patterns.
For example,
/orders/23 /orders/65 /orders/88
might be simply represented as the URI pattern,
/orders/{id}
where {id} is treated as a variable parameter.
The framework uses a specialized handler mapping and command controller support URI patterns. The handler mapping will map the URIs to the appropriate controller. A command controller has been enhanced with a special data binder to support binding URI patterns to command objects.
Simply put, a request representation is the set of parameters supplied by a users request. It, of course, varies depending on the operation and the resource. Frequently, a request representation is used to describe the desired state of the resource or instructions for how to modify the state of the resource.
This framework uses a command controller to map request representations to command objects.
A Response representation is a view of the resource. Naturally, Spring MVC views are used to support this capability. To make this process more RESTful, the responsibility of view selection is abstracted out of the controllers.
This framework provides a specialized set of view selector classes. The expectation is that each controller will specify the supported views (and mappings). When a request comes in, the controller will respond with a model. The framework will then select the appropriate view based on the users request and render the model.
Since this framework is exclusively designed for HTTP, the supported operations are GET, POST, PUT, and DELETE. An individual controller is expected to support a single operation on a single resource. For example,
GET /orders/{id} => GetOrderController DELETE /orders/{id} => DeleteOrderController POST /orders/ => CreateOrderController