|
spring-webmvc | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.web.method.annotation.ModelAttributeMethodProcessor
org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor
public class ServletModelAttributeMethodProcessor
A Servlet-specific ModelAttributeMethodProcessor that applies data
binding through a WebDataBinder of type ServletRequestDataBinder.
Also adds a fall-back strategy to instantiate the model attribute from a URI template variable or from a request parameter if the name matches the model attribute name and there is an appropriate type conversion strategy.
| Field Summary |
|---|
| Fields inherited from class org.springframework.web.method.annotation.ModelAttributeMethodProcessor |
|---|
logger |
| Constructor Summary | |
|---|---|
ServletModelAttributeMethodProcessor(boolean annotationNotRequired)
|
|
| Method Summary | |
|---|---|
protected void |
bindRequestParameters(org.springframework.web.bind.WebDataBinder binder,
org.springframework.web.context.request.NativeWebRequest request)
|
protected java.lang.Object |
createAttribute(java.lang.String attributeName,
org.springframework.core.MethodParameter parameter,
org.springframework.web.bind.support.WebDataBinderFactory binderFactory,
org.springframework.web.context.request.NativeWebRequest request)
Instantiate the model attribute from a URI template variable or from a request parameter if the name matches to the model attribute name and if there is an appropriate type conversion strategy. |
protected java.lang.Object |
createAttributeFromRequestValue(java.lang.String sourceValue,
java.lang.String attributeName,
org.springframework.core.MethodParameter parameter,
org.springframework.web.bind.support.WebDataBinderFactory binderFactory,
org.springframework.web.context.request.NativeWebRequest request)
Create a model attribute from a String request value (e.g. |
protected java.lang.String |
getRequestValueForAttribute(java.lang.String attributeName,
org.springframework.web.context.request.NativeWebRequest request)
Obtain a value from the request that may be used to instantiate the model attribute through type conversion from String to the target type. |
protected java.util.Map<java.lang.String,java.lang.String> |
getUriTemplateVariables(org.springframework.web.context.request.NativeWebRequest request)
|
| Methods inherited from class org.springframework.web.method.annotation.ModelAttributeMethodProcessor |
|---|
handleReturnValue, isBindExceptionRequired, resolveArgument, supportsParameter, supportsReturnType, validateIfApplicable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServletModelAttributeMethodProcessor(boolean annotationNotRequired)
annotationNotRequired - if "true", non-simple method arguments and
return values are considered model attributes with or without a
@ModelAttribute annotation.| Method Detail |
|---|
protected final java.lang.Object createAttribute(java.lang.String attributeName,
org.springframework.core.MethodParameter parameter,
org.springframework.web.bind.support.WebDataBinderFactory binderFactory,
org.springframework.web.context.request.NativeWebRequest request)
throws java.lang.Exception
createAttribute in class org.springframework.web.method.annotation.ModelAttributeMethodProcessorjava.lang.ExceptioncreateAttributeFromRequestValue(String, String, MethodParameter, WebDataBinderFactory, NativeWebRequest)
protected java.lang.String getRequestValueForAttribute(java.lang.String attributeName,
org.springframework.web.context.request.NativeWebRequest request)
The default implementation looks for the attribute name to match a URI variable first and then a request parameter.
attributeName - the model attribute namerequest - the current request
nullprotected final java.util.Map<java.lang.String,java.lang.String> getUriTemplateVariables(org.springframework.web.context.request.NativeWebRequest request)
protected java.lang.Object createAttributeFromRequestValue(java.lang.String sourceValue,
java.lang.String attributeName,
org.springframework.core.MethodParameter parameter,
org.springframework.web.bind.support.WebDataBinderFactory binderFactory,
org.springframework.web.context.request.NativeWebRequest request)
throws java.lang.Exception
The default implementation converts only if there a registered
Converter that can perform the conversion.
sourceValue - the source value to create the model attribute fromattributeName - the name of the attribute, never nullparameter - the method parameterbinderFactory - for creating WebDataBinder instancerequest - the current request
null
java.lang.Exception
protected void bindRequestParameters(org.springframework.web.bind.WebDataBinder binder,
org.springframework.web.context.request.NativeWebRequest request)
Downcast WebDataBinder to ServletRequestDataBinder before binding.
bindRequestParameters in class org.springframework.web.method.annotation.ModelAttributeMethodProcessorServletRequestDataBinderFactory
|
spring-webmvc | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||