Handlers and Their Adapters

Handlers are the actual components responsible for executing the logic in your web application, or delegating to another component executing the logic. Handlers should somehow be able to fulfill an incoming request and return an org.springframework.web.servlet.ModelAndView object containing the logical name of a view and the model the view will render. Out of the box, Spring provides two types of handlers.

All handlers that can inspect the HttpServletRequest and modify the HttpServletResponse by themselves derive from the org.springframework.web.servlet.mvc.Controller interface. Most of Spring's handlers are built using this interface.

There's a second type of handler Spring provides, which doesn't depend on the Servlet's request and response objects. This somewhat resembles the approach taken by the WebWork and Maverick web application frameworks, in that the information from the request the user issues is bound to the handler, which in its turn needs to create a ModelAndView and return it. The interface to implement when you like this approach is org.springframework.web.servlet.mvc.throwaway.ThrowAwayController.

We'll cover the different controllers later, together with some scenarios in which they are especially useful.

Professional Java Development with the Spring Framework
Professional Java Development with the Spring Framework
ISBN: 0764574833
EAN: 2147483647
Year: 2003
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net