|
|||||||||||
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.context.support.WebApplicationObjectSupport org.springframework.web.servlet.support.WebContentGenerator org.springframework.web.servlet.mvc.AbstractController uk.co.lakesidetech.spxforms.web.servlet.mvc.BaseSpXCommandController
Field Summary | |
static java.lang.String |
DEFAULT_COMMAND_NAME
|
Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
HEADER_CACHE_CONTROL, HEADER_EXPIRES, HEADER_PRAGMA, METHOD_GET, METHOD_POST |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
logger |
Constructor Summary | |
BaseSpXCommandController()
|
Method Summary | |
protected ServletRequestSpXFormsDataBinder |
bindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
Bind the parameters of the given request to the given command object. |
protected ServletRequestSpXFormsDataBinder |
createBinder(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
Create a new binder instance for the given command and request. |
protected java.lang.Object |
createCommand()
Create a new command instance for the command class of this controller. |
protected java.lang.Object |
getCommand(javax.servlet.http.HttpServletRequest request)
Retrieve a command object for the given request. |
protected java.lang.Class |
getCommandClass()
Return the command class for this controller. |
protected java.lang.String |
getCommandName()
Return the name of the command in the model. |
protected org.springframework.validation.MessageCodesResolver |
getMessageCodesResolver()
Return the strategy to use for resolving errors into message codes. |
protected org.springframework.validation.Validator |
getValidator()
Return the primary Validator for this controller. |
protected org.springframework.validation.Validator[] |
getValidators()
Return the Validators for this controller. |
protected void |
initApplicationContext()
|
protected void |
initBinder(javax.servlet.http.HttpServletRequest request,
ServletRequestSpXFormsDataBinder binder)
Initialize the given binder instance, for example with custom editors. |
protected boolean |
isValidateOnBinding()
Return if the Validator should get applied when binding. |
protected void |
onBind(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
Callback for custom post-processing in terms of binding. |
protected void |
onBind(javax.servlet.http.HttpServletRequest request,
java.lang.Object command,
org.springframework.validation.BindException errors)
Callback for custom post-processing in terms of binding. |
protected void |
onBindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command,
org.springframework.validation.BindException errors)
Callback for custom post-processing in terms of binding and validation. |
void |
setCommandClass(java.lang.Class commandClass)
Set the command class for this controller. |
void |
setCommandName(java.lang.String commandName)
Set the name of the command in the model. |
void |
setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
Set the strategy to use for resolving errors into message codes. |
void |
setValidateOnBinding(boolean validateOnBinding)
Set if the Validator should get applied when binding. |
void |
setValidator(org.springframework.validation.Validator validator)
Set the Validators for this controller. |
void |
setValidators(org.springframework.validation.Validator[] validators)
Set the primary Validator for this controller. |
protected boolean |
suppressValidation(javax.servlet.http.HttpServletRequest request)
Return whether to suppress validation for the given request. |
Methods inherited from class org.springframework.web.servlet.mvc.AbstractController |
handleRequest, handleRequestInternal, isSynchronizeOnSession, setSynchronizeOnSession |
Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseExpiresHeader |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
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 |
Field Detail |
public static final java.lang.String DEFAULT_COMMAND_NAME
Constructor Detail |
public BaseSpXCommandController()
Method Detail |
public final void setCommandName(java.lang.String commandName)
protected final java.lang.String getCommandName()
public final void setCommandClass(java.lang.Class commandClass)
protected final java.lang.Class getCommandClass()
public final void setValidators(org.springframework.validation.Validator[] validators)
protected final org.springframework.validation.Validator[] getValidators()
public final void setValidator(org.springframework.validation.Validator validator)
protected final org.springframework.validation.Validator getValidator()
public final void setValidateOnBinding(boolean validateOnBinding)
protected final boolean isValidateOnBinding()
public final void setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
Default is null, i.e. using the default strategy of the data binder.
createBinder(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
DataBinder.setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)
protected final org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
protected void initApplicationContext()
protected java.lang.Object getCommand(javax.servlet.http.HttpServletRequest request) throws java.lang.Exception
Default implementation calls createCommand. Subclasses can override this.
request
- current HTTP request
java.lang.Exception
createCommand()
protected java.lang.Object createCommand() throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
- if the command class could not be instantiated
java.lang.IllegalAccessException
- if the class or its constructor is not accessibleprotected final ServletRequestSpXFormsDataBinder bindAndValidate(javax.servlet.http.HttpServletRequest request, java.lang.Object command) throws java.lang.Exception
request
- current HTTP requestcommand
- the command to bind onto
java.lang.Exception
- in case of invalid state or argumentsprotected ServletRequestSpXFormsDataBinder createBinder(javax.servlet.http.HttpServletRequest request, java.lang.Object command) throws java.lang.Exception
Default implementation creates a standard ServletRequestDataBinder, sets the specified MessageCodesResolver (if any), and invokes initBinder. Note that initBinder will not be invoked if you override this method!
request
- current HTTP requestcommand
- the command to bind onto
java.lang.Exception
- in case of invalid state or argumentsbindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
initBinder(javax.servlet.http.HttpServletRequest, uk.co.lakesidetech.spxforms.web.bind.ServletRequestSpXFormsDataBinder)
,
setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)
protected void initBinder(javax.servlet.http.HttpServletRequest request, ServletRequestSpXFormsDataBinder binder) throws java.lang.Exception
This method allows you to register custom editors for certain fields of your command class. For instance, you will be able to transform Date objects into a String pattern and back, in order to allow your JavaBeans to have Date properties and still be able to set and display them in an HTML interface.
Default implementation is empty.
request
- current HTTP requestbinder
- new binder instance
java.lang.Exception
- in case of invalid state or argumentscreateBinder(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
DataBinder.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor)
,
org.springframework.beans.propertyeditors.CustomDateEditor
protected void onBind(javax.servlet.http.HttpServletRequest request, java.lang.Object command, org.springframework.validation.BindException errors) throws java.lang.Exception
Default implementation delegates to onBind(request, command).
request
- current HTTP requestcommand
- the command object to perform further binding onerrors
- validation errors holder, allowing for additional
custom registration of binding errors
java.lang.Exception
- in case of invalid state or argumentsbindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
onBind(HttpServletRequest, Object)
protected void onBind(javax.servlet.http.HttpServletRequest request, java.lang.Object command) throws java.lang.Exception
Default implementation is empty.
request
- current HTTP requestcommand
- the command object to perform further binding on
java.lang.Exception
- in case of invalid state or argumentsonBind(HttpServletRequest, Object, BindException)
protected boolean suppressValidation(javax.servlet.http.HttpServletRequest request)
request
- current HTTP request
protected void onBindAndValidate(javax.servlet.http.HttpServletRequest request, java.lang.Object command, org.springframework.validation.BindException errors) throws java.lang.Exception
Default implementation is empty.
request
- current HTTP requestcommand
- the command object, still allowing for further bindingerrors
- validation errors holder, allowing for additional
custom validation
java.lang.Exception
- in case of invalid state or argumentsbindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object)
,
Errors
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |