|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.interface21.context.support.ApplicationObjectSupport
|
+--com.interface21.web.servlet.mvc.WebContentGenerator
|
+--com.interface21.web.servlet.mvc.AbstractController
|
+--com.interface21.web.servlet.mvc.BaseCommandController
Controller implementation that creates a Command object on receipt of requests, and attempts to populate the command's JavaBean properties with request attributes.
Once created, commands can be validated using a Validator associated with this class. Type mismatches populating a command are treated as validation errors, but caught by the framework, not application code.
Note: This class is the base class for both AbstractFormController and AbstractCommandController (which in turn is the base class for custom controller implementations).
| Field Summary | |
static java.lang.String |
DEFAULT_BEAN_NAME
|
| Fields inherited from class com.interface21.context.support.ApplicationObjectSupport |
logger |
| Constructor Summary | |
BaseCommandController()
|
|
| Method Summary | |
protected ServletRequestDataBinder |
bindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
Bind the parameters of the given request to the given command object. |
protected boolean |
checkCommand(java.lang.Object command)
Check if the given command object is a valid for this controller, i.e. its command class. |
protected ServletRequestDataBinder |
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.String |
getBeanName()
Return the bean name of the command. |
protected java.lang.Class |
getCommandClass()
Return the command class for this controller. |
protected Validator |
getValidator()
Return the validator for this controller. |
protected void |
initBinder(javax.servlet.http.HttpServletRequest request,
ServletRequestDataBinder binder)
Initialize the given binder instance, e.g. with custom editors. |
protected boolean |
isValidateOnBinding()
Return if the validator should get applied when binding. |
protected void |
onBindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command,
BindException errors)
Callback for custom postprocessing in terms of binding and validation. |
void |
setBeanName(java.lang.String beanName)
Set the bean name of the command. |
void |
setCommandClass(java.lang.Class commandClass)
Set the command class for this controller. |
void |
setValidateOnBinding(boolean validateOnBinding)
Set if the validator should get applied when binding. |
void |
setValidator(Validator validator)
Set the validator for this controller (can also be null). |
protected java.lang.Object |
userObject(javax.servlet.http.HttpServletRequest request)
Retrieve a user's command object for the given request. |
| Methods inherited from class com.interface21.web.servlet.mvc.AbstractController |
handleRequest, handleRequestInternal, setCacheSeconds, setRequireSession, setSupportedMethods |
| Methods inherited from class com.interface21.web.servlet.mvc.WebContentGenerator |
cacheForSeconds, preventCaching, setUseExpiresHeader |
| Methods inherited from class com.interface21.context.support.ApplicationObjectSupport |
getApplicationContext, initApplicationContext, 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_BEAN_NAME
| Constructor Detail |
public BaseCommandController()
| Method Detail |
public final void setBeanName(java.lang.String beanName)
protected final java.lang.String getBeanName()
public final void setCommandClass(java.lang.Class commandClass)
protected final java.lang.Class getCommandClass()
public final void setValidator(Validator validator)
protected final Validator getValidator()
public final void setValidateOnBinding(boolean validateOnBinding)
protected final boolean isValidateOnBinding()
protected final boolean checkCommand(java.lang.Object command)
command - command object to check
protected final java.lang.Object createCommand()
throws javax.servlet.ServletException
javax.servlet.ServletException - in case of instantiation errors
protected java.lang.Object userObject(javax.servlet.http.HttpServletRequest request)
throws javax.servlet.ServletException
Default implementation calls createCommand. Subclasses can override this.
request - current HTTP requestcreateCommand()
protected final ServletRequestDataBinder bindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
throws javax.servlet.ServletException
request - current HTTP requestcommand - command to bind ontojavax.servlet.ServletException - in case of invalid state or arguments
protected final ServletRequestDataBinder createBinder(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
throws javax.servlet.ServletException
command - command to bind ontorequest - current requestjavax.servlet.ServletException - in case of invalid state or argumentsbindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object)
protected void initBinder(javax.servlet.http.HttpServletRequest request,
ServletRequestDataBinder binder)
throws javax.servlet.ServletException
request - current requestbinder - new binder instancejavax.servlet.ServletException - in case of invalid state or argumentscreateBinder(javax.servlet.http.HttpServletRequest, java.lang.Object)
protected void onBindAndValidate(javax.servlet.http.HttpServletRequest request,
java.lang.Object command,
BindException errors)
throws javax.servlet.ServletException
request - current HTTP requestcommand - bound commanderrors - binder for additional custom validationjavax.servlet.ServletException - in case of invalid state or argumentsbindAndValidate(javax.servlet.http.HttpServletRequest, java.lang.Object)
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||