|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.web.method.annotation.support.ModelMethodProcessor
public class ModelMethodProcessor
Resolves Map and Model method arguments.
Handles Model return values adding their attributes to the ModelAndViewContainer.
Handles Map return values in the same way as long as the method does not have an @ModelAttribute.
If the method does have an @ModelAttribute, it is assumed the returned Map is a model attribute
and not a model.
| Constructor Summary | |
|---|---|
ModelMethodProcessor()
|
|
| Method Summary | |
|---|---|
void |
handleReturnValue(Object returnValue,
MethodParameter returnType,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest)
Handle the given return value by adding attributes to the model, setting the view (or view name), or by writing to the response. |
Object |
resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest,
WebDataBinderFactory binderFactory)
Resolves a method parameter into an argument value from a given request. |
boolean |
supportsParameter(MethodParameter parameter)
Whether the given method parameter is supported by this resolver. |
boolean |
supportsReturnType(MethodParameter returnType)
Whether the given method return type is supported by this handler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModelMethodProcessor()
| Method Detail |
|---|
public boolean supportsParameter(MethodParameter parameter)
HandlerMethodArgumentResolver
supportsParameter in interface HandlerMethodArgumentResolverparameter - the method parameter to check
true if this resolver supports the supplied parameter; false otherwise
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest,
WebDataBinderFactory binderFactory)
throws Exception
HandlerMethodArgumentResolverModelAndViewContainer
provides access to the model for the request. A WebDataBinderFactory provides a way to create
a WebDataBinder instance when needed for data binding and type conversion purposes.
resolveArgument in interface HandlerMethodArgumentResolverparameter - the method parameter to resolve. This parameter must have previously been passed to
HandlerMethodArgumentResolver.supportsParameter(org.springframework.core.MethodParameter) and it must have returned truemavContainer - the ModelAndViewContainer for the current requestwebRequest - the current requestbinderFactory - a factory for creating WebDataBinder instances
null.
Exception - in case of errors with the preparation of argument valuespublic boolean supportsReturnType(MethodParameter returnType)
HandlerMethodReturnValueHandler
supportsReturnType in interface HandlerMethodReturnValueHandlerreturnType - the method return type to check
true if this handler supports the supplied return type; false otherwise
public void handleReturnValue(Object returnValue,
MethodParameter returnType,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest)
throws Exception
HandlerMethodReturnValueHandlerHandlerMethodReturnValueHandler implementations should also
consider whether to set ModelAndViewContainer.setResolveView(boolean), which is set to
true by default and therefore needs to be set to false explicitly if view
resolution is to be bypassed.
handleReturnValue in interface HandlerMethodReturnValueHandlerreturnValue - the value returned from the handler methodreturnType - the type of the return value. This type must have previously been passed to
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter) and it must have returned truemavContainer - the ModelAndViewContainer for the current requestwebRequest - the current request
Exception - if the return value handling results in an error
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||