Convenient superclass for controller implementations, using the Template
Method design pattern.
As stated in the Controller
interface, a lot of functionality is already provided by certain abstract
base controllers. The AbstractController is one of the most important
abstract base controller providing basic features such as the generation
of caching headers and the enabling or disabling of
supported methods (GET/POST).
Inspection of supported methods (ServletException if request method
is not support)
If session is required, try to get it (ServletException if not found)
Set caching headers if needed according to cacheSeconds propery
Call abstract method handleRequestInternal()
(optionally synchronizing around the call on the HttpSession),
which should be implemented by extending classes to provide actual
functionality to return ModelAndView objects.
comma-separated (CSV) list of methods supported by this controller,
such as GET, POST and PUT
requireSession
false
whether a session should be required for requests to be able to
be handled by this controller. This ensures, derived controller
can - without fear of Nullpointers - call request.getSession() to
retrieve a session. If no session can be found while processing
the request, a ServletException will be thrown
cacheSeconds
-1
indicates the amount of seconds to include in the cache header
for the response following on this request. 0 (zero) will include
headers for no caching at all, -1 (the default) will not generate
any headers and any positive number will generate headers
that state the amount indicated as seconds to cache the content
synchronizeOnSession
false
whether the call to handleRequestInternal should be
synchronized around the HttpSession, to serialize invocations
from the same client. No effect if there is no HttpSession.
Convenient superclass for controller implementations, using the Template Method design pattern.
As stated in the Controller interface, a lot of functionality is already provided by certain abstract base controllers. The AbstractController is one of the most important abstract base controller providing basic features such as the generation of caching headers and the enabling or disabling of supported methods (GET/POST).
Workflow (and that defined by interface):
Exposed configuration properties (and those defined by interface):
handleRequestInternalshould be synchronized around the HttpSession, to serialize invocations from the same client. No effect if there is no HttpSession.