More on Spring MVC
Our handler methods and Spring MVC implementations use only a small portion of the Spring MVC framework. There will be scenarios that the real-world applications encounter that have not been covered in this chapter. These include requirements such as the following:
URI template patterns to access portions of a URL through path variables. They are especially useful to simplify RESTful processing and allow the handler methods to access the variables in URL patterns. The company
find
method could then be mapped to a URL such as/company/find/5/
, where5
represents theidCompany
value. This is achieved through the use of the@PathVariable
annotations and mappings in the form of/company/find/{idCompany}
.Using the
@SessionAttrribute
annotation to store data in the HTTP session between requests.Mapping cookie values with the
@CookieValue
annotation to allow a method parameter to be bound to the value of an HTTP cookie.Mapping request header attributes with the
@RequestHeader
...