|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public abstract class AbstractCommandController
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):
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 | |
---|---|
AbstractCommandController()
Create a new AbstractCommandController. |
|
AbstractCommandController(Class commandClass)
Create a new AbstractCommandController. |
|
AbstractCommandController(Class commandClass,
String commandName)
Create a new AbstractCommandController. |
Method Summary | |
---|---|
protected String |
getCommandInSessionParameterName()
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)
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)
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)
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)
Subclasses are meant to override this method if the controller is expected to handle render requests. |
protected boolean |
isCommandInSession(RenderRequest request)
Determine if there is a valid command (and errors) object in the session for this render request. |
protected 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. |
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 |
---|
public AbstractCommandController()
public AbstractCommandController(Class commandClass)
commandClass
- class of the command beanpublic AbstractCommandController(Class commandClass, String commandName)
commandClass
- class of the command beancommandName
- name of the command beanMethod Detail |
---|
protected final void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception
AbstractController
handleActionRequest
.
The default implementation throws a PortletException.
handleActionRequestInternal
in class AbstractController
Exception
AbstractController.handleActionRequest(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
,
AbstractController.handleRenderRequestInternal(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
protected final ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) throws Exception
AbstractController
handleRenderRequest
.
The default implementation throws a PortletException.
handleRenderRequestInternal
in class AbstractController
Exception
AbstractController.handleRenderRequest(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
,
AbstractController.handleActionRequestInternal(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
protected abstract void handleAction(ActionRequest request, ActionResponse response, Object command, BindException errors) throws 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 holder
Exception
Errors
,
BindException.getModel()
protected abstract ModelAndView handleRender(RenderRequest request, RenderResponse response, Object command, BindException errors) throws 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 holder
Exception
Errors
,
BindException.getModel()
protected String getCommandInSessionParameterName()
PortletRequest.getParameter(java.lang.String)
protected final void setCommandInSession(ActionResponse response)
response
- the current action responsegetCommandInSessionParameterName()
,
isCommandInSession(javax.portlet.RenderRequest)
protected final boolean isCommandInSession(RenderRequest request)
request
- current render request
getCommandInSessionParameterName()
,
setCommandInSession(javax.portlet.ActionResponse)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |