| Base portlet Controller interface, representing a component that receives
RenderRequest/RenderResponse and ActionRequest/ActionResponse like a
Portlet but is able to participate in an MVC workflow.
Any implementation of the portlet Controller interface should be a
reusable, threadsafe class, capable of handling multiple
portlet requests throughout the lifecycle of an application. To be able to
configure Controller(s) in an easy way, Controllers are usually JavaBeans.
Workflow:
After the DispatcherPortlet has received a request and has done its work
to resolve locales, themes and suchlike, it tries to resolve a
Controller to handle that request, using a
org.springframework.web.portlet.HandlerMapping HandlerMapping .
When a Controller has been found, the
Controller.handleRenderRequest handleRenderRequest or
Controller.handleActionRequest handleActionRequest method will be invoked, which is responsible for handling the actual
request and - if applicable - returning an appropriate ModelAndView.
So actually, these method are the main entrypoint for the
org.springframework.web.portlet.DispatcherPortlet DispatcherPortlet which delegates requests to controllers. These method - and also this interface -
should preferrably not be implemented by custom controllers directly, since
abstract controllers also provided by this package already provide a lot of
functionality for typical use cases in portlet applications. A few examples of
those controllers:
AbstractController AbstractController ,
AbstractCommandController AbstractCommandController ,
AbstractFormController AbstractFormController ,
SimpleFormController SimpleFormController .
So basically any direct implementation of the Controller interface
just handles RenderRequests/ActionRequests and should return a ModelAndView, to be
further used by the DispatcherPortlet. Any additional functionality such as
optional validation, form handling, etc should be obtained through extending
one of the abstract controller classes mentioned above.
author: William G. Thompson, Jr. author: John A. Lewis since: 2.0 See Also: SimpleControllerHandlerAdapter See Also: AbstractController See Also: AbstractCommandController See Also: AbstractFormController See Also: SimpleFormController See Also: org.springframework.context.ApplicationContextAware See Also: org.springframework.context.ResourceLoaderAware See Also: org.springframework.web.portlet.context.PortletContextAware |