public abstract class

AbstractCommandController

extends BaseCommandController
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

This class is deprecated.
as of Spring 3.0, in favor of annotated controllers

Class Overview

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):

Summary

[Expand]
Inherited Constants
From class org.springframework.web.portlet.mvc.BaseCommandController
[Expand]
Inherited Fields
From class org.springframework.context.support.ApplicationObjectSupport
Public Constructors
AbstractCommandController()
Create a new AbstractCommandController.
AbstractCommandController(Class commandClass)
Create a new AbstractCommandController.
AbstractCommandController(Class commandClass, String commandName)
Create a new AbstractCommandController.
Protected Methods
String getCommandInSessionParameterName()
Return the name of the render parameter that indicates there is a valid command (and errors) object in the session.
abstract void handleAction(ActionRequest request, ActionResponse response, Object command, BindException errors)
Template method for request handling, providing a populated and validated instance of the command class, and an Errors object containing binding and validation errors.
final void handleActionRequestInternal(ActionRequest request, ActionResponse response)
Subclasses are meant to override this method if the controller is expected to handle action requests.
abstract ModelAndView handleRender(RenderRequest request, RenderResponse response, Object command, BindException errors)
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.
final ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response)
Subclasses are meant to override this method if the controller is expected to handle render requests.
boolean isCommandInSession(RenderRequest request)
Determine if there is a valid command (and errors) object in the session for this render request.
final void setCommandInSession(ActionResponse response)
Set the action response parameter that indicates there is a command (and errors) object in the session for the render phase.
[Expand]
Inherited Methods
From class org.springframework.web.portlet.mvc.BaseCommandController
From class org.springframework.web.portlet.mvc.AbstractController
From class org.springframework.web.portlet.handler.PortletContentGenerator
From class org.springframework.web.portlet.context.PortletApplicationObjectSupport
From class org.springframework.context.support.ApplicationObjectSupport
From class java.lang.Object
From interface org.springframework.context.ApplicationContextAware
From interface org.springframework.web.portlet.context.PortletContextAware
From interface org.springframework.web.portlet.mvc.Controller

Public Constructors

public AbstractCommandController ()

Create a new AbstractCommandController.

public AbstractCommandController (Class commandClass)

Create a new AbstractCommandController.

Parameters
commandClass class of the command bean

public AbstractCommandController (Class commandClass, String commandName)

Create a new AbstractCommandController.

Parameters
commandClass class of the command bean
commandName name of the command bean

Protected Methods

protected String getCommandInSessionParameterName ()

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
  • javax.portlet.RenderRequest#getParameter

protected abstract void handleAction (ActionRequest request, ActionResponse response, Object command, BindException errors)

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

protected final void handleActionRequestInternal (ActionRequest request, ActionResponse response)

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.

Throws
Exception

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

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

protected final ModelAndView handleRenderRequestInternal (RenderRequest request, RenderResponse response)

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.

Throws
Exception

protected boolean isCommandInSession (RenderRequest request)

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

protected final void setCommandInSession (ActionResponse response)

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