org.springframework.web.servlet.mvc

## Class AbstractCommandController

- java.lang.Object
- - org.springframework.context.support.ApplicationObjectSupport
  - - org.springframework.web.context.support.WebApplicationObjectSupport
    - - org.springframework.web.servlet.support.WebContentGenerator
      - - org.springframework.web.servlet.mvc.AbstractController
        - - org.springframework.web.servlet.mvc.BaseCommandController
          - - org.springframework.web.servlet.mvc.AbstractCommandController

All Implemented Interfaces:
  Aware, ApplicationContextAware, ServletContextAware, Controller

Deprecated.
as of Spring 3.0, in favor of annotated controllers

    @Deprecated
    public abstract class AbstractCommandController
    extends BaseCommandController

Abstract base class for custom command controllers.

Autopopulates a command bean from the request. For command validation, a validator (property inherited from `BaseCommandController`) can be used.

In most cases this command controller should not be used to handle form submission, because functionality for forms is offered in more detail by the `AbstractFormController` and its corresponding implementations.

Exposed configuration properties (and those defined by superclass):
none (so only those available in superclass).

Workflow (and that defined by superclass):

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  `BaseCommandController.setCommandClass(java.lang.Class)`, `BaseCommandController.setCommandName(java.lang.String)`, `BaseCommandController.setValidator(org.springframework.validation.Validator)`

### Field Summary

### Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController

`DEFAULT_COMMAND_NAME`

### Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator

`METHOD_GET, METHOD_HEAD, METHOD_POST`

### Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

`logger`

### Constructor Summary

Constructors
Constructor and Description
`AbstractCommandController()` Deprecated. Create a new AbstractCommandController.
`AbstractCommandController(Class commandClass)` Deprecated. Create a new AbstractCommandController.
`AbstractCommandController(Class commandClass, String commandName)` Deprecated. Create a new AbstractCommandController.

### Method Summary

Methods
`protected abstract ModelAndView` `handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)` Deprecated. Template method for request handling, providing a populated and validated instance of the command class, and an Errors object containing binding and validation errors.
`protected ModelAndView` `handleRequestInternal(HttpServletRequest request, HttpServletResponse response)` Deprecated. Template method.

### Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController

`bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommand, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, initBinder, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, suppressValidation, useDirectFieldAccess`

### Methods inherited from class org.springframework.web.servlet.mvc.AbstractController

`handleRequest, isSynchronizeOnSession, setSynchronizeOnSession`

### Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator

`applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isAlwaysMustRevalidate, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setAlwaysMustRevalidate, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader`

### Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

`getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext`

### Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

`getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractCommandController

    public AbstractCommandController()

Deprecated.
Create a new AbstractCommandController.

#### AbstractCommandController

    public AbstractCommandController(Class commandClass)

Deprecated.
Create a new AbstractCommandController.

Parameters:
  `commandClass` - class of the command bean

#### AbstractCommandController

    public AbstractCommandController(Class commandClass,
                             String commandName)

Deprecated.
Create a new AbstractCommandController.

Parameters:
  `commandClass` - class of the command bean
  `commandName` - name of the command bean

### Method Detail

#### handleRequestInternal

    protected ModelAndView handleRequestInternal(HttpServletRequest request,
                                     HttpServletResponse response)
                                          throws Exception

Deprecated.
Description copied from class: `AbstractController`
Template method. Subclasses must implement this. The contract is the same as for `handleRequest`.

Specified by:
  `handleRequestInternal` in class `AbstractController`
Throws:
  `Exception`
See Also:
  `AbstractController.handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)`

#### handle

    protected abstract ModelAndView handle(HttpServletRequest request,
                      HttpServletResponse response,
                      Object command,
                      BindException errors)
                                    throws Exception

Deprecated.
Template method for request handling, providing a populated and validated instance of the command class, and an Errors object containing binding and validation errors.

Call `errors.getModel()` to populate the ModelAndView model with the command and the Errors instance, under the specified command name, as expected by the "spring:bind" tag.

Parameters:
  `request` - current HTTP request
  `response` - current HTTP response
  `command` - the populated command object
  `errors` - validation errors holder
Returns:
  a ModelAndView to render, or `null` if handled directly
Throws:
  `Exception`
See Also:
  `Errors`, `BindException.getModel()`