Workflow
(and that defined by interface):
handleRequest()
will be called by the DispatcherServlethandleRequestInternal()
(optionally synchronizing around the call on the HttpSession),
which should be implemented by extending classes to provide actual
functionality to return ModelAndView objects.Exposed configuration properties
(and those defined by interface):
| name | default | description |
| supportedMethods | GET,POST | 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 that derived controller can - without fear of null pointers - 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.
|
WebContentInterceptor
| Modifier and Type | Field and Description |
|---|---|
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | AbstractController()
Create a new AbstractController which supports HTTP methods GET, HEAD and POST by default. |
| public | AbstractController(boolean
true if this
controller should support HTTP methods GET, HEAD and POST by default,
or false if it should be unrestrictedCreate a new AbstractController. |
| Modifier and Type | Method and Description |
|---|---|
| public ModelAndView | handleRequest(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response)Implements org. Process the request and return a ModelAndView object which the DispatcherServlet will render. |
| protected abstract ModelAndView | |
| public final boolean | |
| public final void | setSynchronizeOnSession(boolean synchronizeOnSession)
Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client. |
| synchronizeOnSession | back to summary |
|---|---|
| private boolean synchronizeOnSession | |
| AbstractController | back to summary |
|---|---|
| public AbstractController() Create a new AbstractController which supports HTTP methods GET, HEAD and POST by default. | |
| AbstractController | back to summary |
|---|---|
| public AbstractController(boolean restrictDefaultSupportedMethods) Create a new AbstractController.
| |
| handleRequest | back to summary |
|---|---|
| public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception Implements org. Doc from org. Process the request and return a ModelAndView object which the DispatcherServlet
will render. A
| |
| handleRequestInternal | back to summary |
|---|---|
| protected abstract ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception Template method. Subclasses must implement this.
The contract is the same as for
| |
| isSynchronizeOnSession | back to summary |
|---|---|
| public final boolean isSynchronizeOnSession() Return whether controller execution should be synchronized on the session. | |
| setSynchronizeOnSession | back to summary |
|---|---|
| public final void setSynchronizeOnSession(boolean synchronizeOnSession) Set if controller execution should be synchronized on the session, to serialize parallel invocations from the same client. More specifically, the execution of the The session mutex is guaranteed to be the same object during
the entire lifetime of the session, available under the key defined
by the In many cases, the HttpSession reference itself is a safe mutex as well, since it will always be the same object reference for the same active logical session. However, this is not guaranteed across different servlet containers; the only 100% safe way is a session mutex. | |