@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).
BaseCommandController.setCommandClass(java.lang.Class)
,
BaseCommandController.setCommandName(java.lang.String)
,
BaseCommandController.setValidator(org.springframework.validation.Validator)
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COMMAND_IN_SESSION_PARAMETER
Deprecated.
This render parameter is used to indicate forward to the render phase
that a valid command (and errors) object is in the session.
|
private static java.lang.String |
TRUE
Deprecated.
|
DEFAULT_COMMAND_NAME
logger
Constructor and Description |
---|
AbstractCommandController()
Deprecated.
Create a new AbstractCommandController.
|
AbstractCommandController(java.lang.Class commandClass)
Deprecated.
Create a new AbstractCommandController.
|
AbstractCommandController(java.lang.Class commandClass,
java.lang.String commandName)
Deprecated.
Create a new AbstractCommandController.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.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,
java.lang.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,
java.lang.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.
|
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
handleActionRequest, handleRenderRequest, isRenderWhenMinimized, isSynchronizeOnSession, setRenderWhenMinimized, setSynchronizeOnSession
applyCacheSeconds, cacheForSeconds, check, checkAndPrepare, checkAndPrepare, getCacheSeconds, isRequireSession, preventCaching, setCacheSeconds, setRequireSession
getPortletContext, getTempDir, isContextRequired, setPortletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
private static final java.lang.String COMMAND_IN_SESSION_PARAMETER
private static final java.lang.String TRUE
public AbstractCommandController()
public AbstractCommandController(java.lang.Class commandClass)
commandClass
- class of the command beanpublic AbstractCommandController(java.lang.Class commandClass, java.lang.String commandName)
commandClass
- class of the command beancommandName
- name of the command beanprotected final void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws java.lang.Exception
AbstractController
handleActionRequest
.
The default implementation throws a PortletException.
handleActionRequestInternal
in class AbstractController
java.lang.Exception
AbstractController.handleActionRequest(ActionRequest, ActionResponse)
,
AbstractController.handleRenderRequestInternal(RenderRequest, RenderResponse)
protected final ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws java.lang.Exception
AbstractController
handleRenderRequest
.
The default implementation throws a PortletException.
handleRenderRequestInternal
in class AbstractController
java.lang.Exception
AbstractController.handleRenderRequest(RenderRequest, RenderResponse)
,
AbstractController.handleActionRequestInternal(ActionRequest, ActionResponse)
protected abstract void handleAction(ActionRequest request, ActionResponse response, java.lang.Object command, BindException errors) throws java.lang.Exception
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.
request
- current action requestresponse
- current action responsecommand
- the populated command objecterrors
- validation errors holderjava.lang.Exception
Errors
,
BindException.getModel()
protected abstract ModelAndView handleRender(RenderRequest request, RenderResponse response, java.lang.Object command, BindException errors) throws java.lang.Exception
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.
request
- current render requestresponse
- current render responsecommand
- the populated command objecterrors
- validation errors holderjava.lang.Exception
Errors
,
BindException.getModel()
protected java.lang.String getCommandInSessionParameterName()
javax.portlet.RenderRequest#getParameter
protected final void setCommandInSession(ActionResponse response)
response
- the current action responsegetCommandInSessionParameterName()
,
isCommandInSession(RenderRequest)
protected boolean isCommandInSession(RenderRequest request)
request
- current render requestgetCommandInSessionParameterName()
,
setCommandInSession(ActionResponse)