org.springframework.web.portlet.mvc

## Class AbstractCommandController

- java.lang.Object
- - org.springframework.context.support.ApplicationObjectSupport
  - - org.springframework.web.portlet.context.PortletApplicationObjectSupport
    - - org.springframework.web.portlet.handler.PortletContentGenerator
      - - org.springframework.web.portlet.mvc.AbstractController
        - - org.springframework.web.portlet.mvc.BaseCommandController
          - - org.springframework.web.portlet.mvc.AbstractCommandController

- All Implemented Interfaces:
    Aware, ApplicationContextAware, PortletContextAware, 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.

  This command controller should preferrable not be used to handle form submission, because functionality for forms is more 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):

  Since:
    2.0
  Author:
    John A. Lewis, 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.portlet.mvc.BaseCommandController

      `DEFAULT_COMMAND_NAME`

    - ### 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
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `getCommandInSessionParameterName()` Deprecated. Return the name of the render parameter that indicates there is a valid command (and errors) object in the session.
    `protected abstract void` | `handleAction(ActionRequest request, ActionResponse 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 void` | `handleActionRequestInternal(ActionRequest request, ActionResponse response)` Deprecated. Subclasses are meant to override this method if the controller is expected to handle action requests.
    `protected abstract ModelAndView` | `handleRender(RenderRequest request, RenderResponse response, Object command, BindException errors)` Deprecated. Template method for render request handling, providing a populated and validated instance of the command class, and an Errors object containing binding and validation errors.
    `protected ModelAndView` | `handleRenderRequestInternal(RenderRequest request, RenderResponse response)` Deprecated. Subclasses are meant to override this method if the controller is expected to handle render requests.
    `protected boolean` | `isCommandInSession(RenderRequest request)` Deprecated. Determine if there is a valid command (and errors) object in the session for this render request.
    `protected void` | `setCommandInSession(ActionResponse response)` Deprecated. Set the action response parameter that indicates there is a command (and errors) object in the session for the render phase.

    - ### Methods inherited from class org.springframework.web.portlet.mvc.BaseCommandController

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

    - ### Methods inherited from class org.springframework.web.portlet.mvc.AbstractController

      `handleActionRequest, handleRenderRequest, isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSession`

    - ### Methods inherited from class org.springframework.web.portlet.handler.PortletContentGenerator

      `applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession`

    - ### Methods inherited from class org.springframework.web.portlet.context.PortletApplicationObjectSupport

      `getPortletContext, getTempDir, isContextRequired, setPortletContext`

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

      `getApplicationContext, getMessageSourceAccessor, initApplicationContext, 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

    - #### handleActionRequestInternal

          protected final void handleActionRequestInternal(ActionRequest request,
                                         ActionResponse response)
                                                    throws Exception

      Deprecated.
      Description copied from class: `AbstractController`
      Subclasses are meant to override this method if the controller is expected to handle action requests. The contract is the same as for `handleActionRequest`.

      The default implementation throws a PortletException.

      Overrides:
        `handleActionRequestInternal` in class `AbstractController`
      Throws:
        `Exception`
      See Also:
        `AbstractController.handleActionRequest(javax.portlet.ActionRequest, javax.portlet.ActionResponse)`, `AbstractController.handleRenderRequestInternal(javax.portlet.RenderRequest, javax.portlet.RenderResponse)`

    - #### handleRenderRequestInternal

          protected final ModelAndView handleRenderRequestInternal(RenderRequest request,
                                                 RenderResponse response)
                                                            throws Exception

      Deprecated.
      Description copied from class: `AbstractController`
      Subclasses are meant to override this method if the controller is expected to handle render requests. The contract is the same as for `handleRenderRequest`.

      The default implementation throws a PortletException.

      Overrides:
        `handleRenderRequestInternal` in class `AbstractController`
      Throws:
        `Exception`
      See Also:
        `AbstractController.handleRenderRequest(javax.portlet.RenderRequest, javax.portlet.RenderResponse)`, `AbstractController.handleActionRequestInternal(javax.portlet.ActionRequest, javax.portlet.ActionResponse)`

    - #### handleAction

          protected abstract void handleAction(ActionRequest request,
                          ActionResponse 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 action request
        `response` - current action response
        `command` - the populated command object
        `errors` - validation errors holder
      Throws:
        `Exception`
      See Also:
        `Errors`, `BindException.getModel()`

    - #### handleRender

          protected abstract ModelAndView handleRender(RenderRequest request,
                                  RenderResponse response,
                                  Object command,
                                  BindException errors)
                                                throws Exception

      Deprecated.
      Template method for render 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 render request
        `response` - current render 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()`

    - #### getCommandInSessionParameterName

          protected String getCommandInSessionParameterName()

      Deprecated.
      Return the name of the render parameter that indicates there is a valid command (and errors) object in the session.
      Returns:
        the name of the render parameter
      See Also:
        `PortletRequest.getParameter(java.lang.String)`

    - #### setCommandInSession

          protected final void setCommandInSession(ActionResponse response)

      Deprecated.
      Set the action response parameter that indicates there is a command (and errors) object in the session for the render phase.
      Parameters:
        `response` - the current action response
      See Also:
        `getCommandInSessionParameterName()`, `isCommandInSession(javax.portlet.RenderRequest)`

    - #### isCommandInSession

          protected boolean isCommandInSession(RenderRequest request)

      Deprecated.
      Determine if there is a valid command (and errors) object in the session for this render request.
      Parameters:
        `request` - current render request
      Returns:
        if there is a valid command object in the session
      See Also:
        `getCommandInSessionParameterName()`, `setCommandInSession(javax.portlet.ActionResponse)`