|
Anyframe Web | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.support.WebContentGenerator
org.springframework.web.servlet.mvc.AbstractController
org.springframework.web.servlet.mvc.BaseCommandController
org.springframework.web.servlet.mvc.AbstractFormController
org.springframework.web.servlet.mvc.SimpleFormController
anyframe.web.springmvc.controller.AnyframeFormController
public class AnyframeFormController
AnyframeFormController Class which provide
exception, pre/post execution features.
| Field Summary | |
|---|---|
static java.lang.String |
LAST_MODIFIED_METHOD_SUFFIX
Suffix for last-modified methods |
static java.lang.String |
PAGE_NOT_FOUND_LOG_CATEGORY
Log category to use when no mapped handler is found for a request. |
protected static org.apache.commons.logging.Log |
pageNotFoundLogger
Additional logger to use when no mapped handler is found for a request. |
| Fields inherited from class org.springframework.web.servlet.mvc.BaseCommandController |
|---|
DEFAULT_COMMAND_NAME |
| Fields inherited from class org.springframework.web.servlet.support.WebContentGenerator |
|---|
METHOD_GET, METHOD_HEAD, METHOD_POST |
| Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
AnyframeFormController()
|
|
| Method Summary | |
|---|---|
protected void |
bind(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
Bind request parameters onto the given command bean |
protected java.lang.reflect.Method |
getExceptionHandler(java.lang.Throwable exception)
Determine the exception handler method for the given exception. |
long |
getLastModified(javax.servlet.http.HttpServletRequest request)
Try to find an XXXXLastModified method, where XXXX is the name of a handler. |
org.apache.commons.logging.Log |
getLogger()
|
org.springframework.web.servlet.mvc.multiaction.MethodNameResolver |
getMethodNameResolver()
Return the MethodNameResolver used by this class. |
java.lang.String |
getSuccess_add()
|
java.lang.String |
getSuccess_addView()
|
java.lang.String |
getSuccess_delete()
|
java.lang.String |
getSuccess_get()
|
java.lang.String |
getSuccess_list()
|
java.lang.String |
getSuccess_update()
|
protected org.springframework.web.servlet.ModelAndView |
handleInvalidSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
preventing duplicate form submission and then show the message that key is "common.msg.invalidtoken.error" |
protected org.springframework.web.servlet.ModelAndView |
handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handle the case where no request handler method was found. |
protected org.springframework.web.servlet.ModelAndView |
handleRequestInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Determine a handler method and invoke it. |
protected void |
initBinder(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.ServletRequestDataBinder binder)
Support binding of Date type. |
protected org.springframework.web.servlet.ModelAndView |
invokeNamedMethod(java.lang.String methodName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invokes the named method. |
boolean |
isShowNewForm()
|
protected java.lang.Object |
newCommandObject(java.lang.Class clazz)
Create a new command object of the given class. |
org.springframework.web.servlet.ModelAndView |
onSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object command,
org.springframework.validation.BindException errors)
Submit callback with all parameters. |
protected void |
postProcess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
protected void |
preProcess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
protected org.springframework.web.servlet.ModelAndView |
process(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Determine a handler method and invoke it. |
protected org.springframework.web.servlet.ModelAndView |
processCheckedException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception checkedException)
|
protected org.springframework.web.servlet.ModelAndView |
processFinally(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.web.servlet.ModelAndView result)
|
protected org.springframework.web.servlet.ModelAndView |
processUnCheckedException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.RuntimeException uncheckedException)
|
void |
setDelegate(java.lang.Object delegate)
Set the delegate used by this class; the default is this, assuming that handler
methods have been added by a subclass. |
void |
setMessageSource(org.springframework.context.MessageSource messageSource)
|
void |
setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver)
Set the method name resolver that this class should use. |
void |
setShowNewForm(boolean showNewForm)
|
void |
setSuccess_add(java.lang.String success_add)
|
void |
setSuccess_addView(java.lang.String success_addView)
|
void |
setSuccess_delete(java.lang.String success_delete)
|
void |
setSuccess_get(java.lang.String success_get)
|
void |
setSuccess_list(java.lang.String success_list)
|
void |
setSuccess_update(java.lang.String success_update)
|
| Methods inherited from class org.springframework.web.servlet.mvc.SimpleFormController |
|---|
doSubmitAction, getFormView, getSuccessView, isFormChangeRequest, isFormChangeRequest, onFormChange, onFormChange, onSubmit, onSubmit, processFormSubmission, referenceData, referenceData, setFormView, setSuccessView, showForm, showForm, suppressValidation |
| Methods inherited from class org.springframework.web.servlet.mvc.AbstractFormController |
|---|
currentFormObject, formBackingObject, getCommand, getErrorsForNewForm, getFormSessionAttributeName, getFormSessionAttributeName, isBindOnNewForm, isFormSubmission, isSessionForm, onBindOnNewForm, onBindOnNewForm, setBindOnNewForm, setSessionForm, showForm, showForm, showNewForm |
| Methods inherited from class org.springframework.web.servlet.mvc.BaseCommandController |
|---|
bindAndValidate, checkCommand, createBinder, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, isValidateOnBinding, onBind, onBind, onBindAndValidate, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, useDirectFieldAccess |
| Methods inherited from class org.springframework.web.servlet.mvc.AbstractController |
|---|
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession |
| Methods inherited from class org.springframework.web.servlet.support.WebContentGenerator |
|---|
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader |
| Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
|---|
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
| 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 LAST_MODIFIED_METHOD_SUFFIX
public static final java.lang.String PAGE_NOT_FOUND_LOG_CATEGORY
pageNotFoundLogger,
Constant Field Valuesprotected static final org.apache.commons.logging.Log pageNotFoundLogger
PAGE_NOT_FOUND_LOG_CATEGORY| Constructor Detail |
|---|
public AnyframeFormController()
| Method Detail |
|---|
public void setMessageSource(org.springframework.context.MessageSource messageSource)
setMessageSource in interface org.springframework.context.MessageSourceAware
public org.apache.commons.logging.Log getLogger()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.String getSuccess_list()
public void setSuccess_list(java.lang.String success_list)
public java.lang.String getSuccess_get()
public void setSuccess_get(java.lang.String success_get)
public java.lang.String getSuccess_update()
public void setSuccess_update(java.lang.String success_update)
public java.lang.String getSuccess_add()
public void setSuccess_add(java.lang.String success_add)
public java.lang.String getSuccess_delete()
public void setSuccess_delete(java.lang.String success_delete)
public java.lang.String getSuccess_addView()
public void setSuccess_addView(java.lang.String success_addView)
public boolean isShowNewForm()
public void setShowNewForm(boolean showNewForm)
public org.springframework.web.servlet.ModelAndView onSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Object command,
org.springframework.validation.BindException errors)
throws java.lang.Exception
The default implementation delegates to
SimpleFormController.onSubmit(Object, BindException). For
simply performing a submit action and rendering
the specified success view, consider
implementing SimpleFormController.doSubmitAction(java.lang.Object) rather than
an onSubmit variant.
Subclasses can override this to provide custom submission handling like storing the object to the database. Implementations can also perform custom validation and call showForm to return to the form. Do not implement multiple onSubmit methods: In that case, just this method will be called by the controller.
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.
onSubmit in class org.springframework.web.servlet.mvc.SimpleFormControllerrequest - current servlet requestresponse - current servlet responsecommand - form object with request parameters bound
onto iterrors - Errors instance without errors (subclass
can add errors if it wants to)
null
java.lang.Exception - in case of errorsSimpleFormController.onSubmit(Object, BindException),
SimpleFormController.doSubmitAction(java.lang.Object),
SimpleFormController.showForm(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.validation.BindException),
Errors,
BindException.getModel()
protected void preProcess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
java.lang.Exception
protected void postProcess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
java.lang.Exception
protected org.springframework.web.servlet.ModelAndView processCheckedException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception checkedException)
throws java.lang.Exception
java.lang.Exception
protected org.springframework.web.servlet.ModelAndView processUnCheckedException(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.RuntimeException uncheckedException)
throws java.lang.Exception
java.lang.Exception
protected org.springframework.web.servlet.ModelAndView processFinally(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.web.servlet.ModelAndView result)
throws java.lang.Exception
java.lang.Exception
protected org.springframework.web.servlet.ModelAndView handleRequestInternal(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
handleRequestInternal in class org.springframework.web.servlet.mvc.AbstractFormControllerjava.lang.ExceptionMethodNameResolver.getHandlerMethodName(javax.servlet.http.HttpServletRequest),
invokeNamedMethod(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse),
handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected org.springframework.web.servlet.ModelAndView process(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
java.lang.ExceptionMethodNameResolver.getHandlerMethodName(javax.servlet.http.HttpServletRequest),
invokeNamedMethod(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse),
handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)public final void setDelegate(java.lang.Object delegate)
this, assuming that handler
methods have been added by a subclass.
This method does not get invoked once the class is configured.
delegate - an object containing handler methods
java.lang.IllegalStateException - if no handler methods are foundpublic final void setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver)
Allows parameterization of handler method mappings.
public final org.springframework.web.servlet.mvc.multiaction.MethodNameResolver getMethodNameResolver()
public long getLastModified(javax.servlet.http.HttpServletRequest request)
LastModified.getLastModified(HttpServletRequest)
protected org.springframework.web.servlet.ModelAndView handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
The default implementation logs a warning and sends an HTTP 404 error. Alternatively, a fallback view could be chosen, or the NoSuchRequestHandlingMethodException could be rethrown as-is.
ex - the NoSuchRequestHandlingMethodException
to be handledrequest - current HTTP requestresponse - current HTTP response
null if handled directly
java.lang.Exception - an Exception that should be thrown as
result of the servlet request
protected final org.springframework.web.servlet.ModelAndView invokeNamedMethod(java.lang.String methodName,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
Uses a custom exception handler if possible; otherwise, throw an unchecked exception; wrap a checked exception or Throwable.
java.lang.Exception
protected java.lang.Object newCommandObject(java.lang.Class clazz)
throws java.lang.Exception
This implementation uses
BeanUtils.instantiateClass, so
commands need to have public no-arg
constructors. Subclasses can override this
implementation if desired.
java.lang.Exception - if the command object could not be
instantiatedBeanUtils.instantiateClass(Class)
protected void bind(javax.servlet.http.HttpServletRequest request,
java.lang.Object command)
throws java.lang.Exception
request - request from which parameters will be
boundcommand - command object, that must be a JavaBean
java.lang.Exception - in case of invalid state or argumentsprotected java.lang.reflect.Method getExceptionHandler(java.lang.Throwable exception)
Can return null if not found.
exception - the exception to handle
null
protected org.springframework.web.servlet.ModelAndView handleInvalidSubmit(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.lang.Exception
handleInvalidSubmit in class org.springframework.web.servlet.mvc.AbstractFormControllerjava.lang.Exception
protected void initBinder(javax.servlet.http.HttpServletRequest request,
org.springframework.web.bind.ServletRequestDataBinder binder)
throws java.lang.Exception
initBinder in class org.springframework.web.servlet.mvc.BaseCommandControllerjava.lang.Exception
|
Anyframe Web | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||