.
So, in AbstractController there is a final method handleRequest():
{code:title=AbstractController handleRequest()}
public final ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception {
// delegate to WebContentGenerator for checking and preparing
checkAndPrepare(request, response, this instanceof LastModified);
// execute in synchronized block if required
if (this.synchronizeOnSession) {
HttpSession session = request.getSession(false);
if (session != null) {
synchronized (session) {
return handleRequestInternal(request, response);
}
}
}
return handleRequestInternal(request, response);
}
{code}
As we can see here, it delegates to the method handleRequestInternal(), which is declared to be abstract:
{code|title=AbstractController handleRequestInternal()}
/**
* Template method. Subclasses must implement this.
* The contract is the same as for handleRequest.
* @see #handleRequest
*/
protected abstract ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
throws Exception;
{code}
LoginController defaults this Command class:
{code:title=LoginController afterPropertiesSet() excerpt}
public void afterPropertiesSet() throws Exception {
if (this.getCommandClass() == null) {
this.setCommandName("credentials");
this.setCommandClass(UsernamePasswordCredentials.class);
{code}
In BaseCommandController, we have: |