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/, where 5 represents the idCompany 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 annotation to allow a method parameter to be bound to a request header.
  • Asynchronous request processing to allow the main servlet container thread to be released and allowed to process other requests.
  • Integrating Spring MVC with Spring Security (highly recommended for enterprise applications).
  • Parsing multipart requests to allow the users to upload files from HTML forms.

The testing of the handler classes using the Spring MVC Test framework should also be considered for enterprise Spring MVC applications. For more information, see the comprehensive guide at http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/testing.html#spring-mvc-test-framework. The framework provides JUnit support for testing the client- and server-side Spring MVC applications.

There is much more to the Spring MVC framework than can ever be covered in a single chapter. We recommend users find out more about Spring MVC capabilities from the excellent online resource at http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.138.202