Polish "Support flash attrs..." and related classes
- Eliminate trailing whitespace
- Update long method signatures to follow framework whitespace
conventions
Based on the following search,
$ git grep -A3 '^.public .* .*([^\{;]*$' */src/main
the strong convention throughout the framework when dealing with
methods having long signatures (i.e. many parameters) is to break
immediately after the opening paren, indent two tabs deeper and break
lines around 90 characters as necessary. Such signatures should also
be followed by a newline after the opening curly brace to break
things up visually.
The files edited in this commit had a particularly different style of
intenting arguments to align with each other vertically, but the
alignment only worked if one's tabstop is set at four spaces.
When viewed at a different tabstop value, the effect is is jarring,
both in that it is misaligned and significantly different from most
of the framework. The convention described above reads well at any
tabstop value.
This commit is contained in:
parent
92f8446eea
commit
d7d1b495f2
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -66,10 +66,9 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
|
||||||
return HttpEntity.class.equals(parameterType) || ResponseEntity.class.equals(parameterType);
|
return HttpEntity.class.equals(parameterType) || ResponseEntity.class.equals(parameterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory)
|
|
||||||
throws IOException, HttpMediaTypeNotSupportedException {
|
throws IOException, HttpMediaTypeNotSupportedException {
|
||||||
|
|
||||||
HttpInputMessage inputMessage = createInputMessage(webRequest);
|
HttpInputMessage inputMessage = createInputMessage(webRequest);
|
||||||
|
|
@ -100,10 +99,10 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
|
||||||
+ "in method " + parameter.getMethod() + "is not parameterized");
|
+ "in method " + parameter.getMethod() + "is not parameterized");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
mavContainer.setRequestHandled(true);
|
mavContainer.setRequestHandled(true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,11 @@ public class ModelAndViewMethodReturnValueHandler implements HandlerMethodReturn
|
||||||
return ModelAndView.class.isAssignableFrom(returnType.getParameterType());
|
return ModelAndView.class.isAssignableFrom(returnType.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue == null) {
|
if (returnValue == null) {
|
||||||
mavContainer.setRequestHandled(true);
|
mavContainer.setRequestHandled(true);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -71,10 +71,10 @@ public class ModelAndViewResolverMethodReturnValueHandler implements HandlerMeth
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest request)
|
||||||
NativeWebRequest request) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (this.mavResolvers != null) {
|
if (this.mavResolvers != null) {
|
||||||
for (ModelAndViewResolver mavResolver : this.mavResolvers) {
|
for (ModelAndViewResolver mavResolver : this.mavResolvers) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -46,10 +46,11 @@ public class RedirectAttributesMethodArgumentResolver implements HandlerMethodAr
|
||||||
return RedirectAttributes.class.isAssignableFrom(parameter.getParameterType());
|
return RedirectAttributes.class.isAssignableFrom(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
DataBinder dataBinder = binderFactory.createBinder(webRequest, null, null);
|
DataBinder dataBinder = binderFactory.createBinder(webRequest, null, null);
|
||||||
ModelMap redirectAttributes = new RedirectAttributesModelMap(dataBinder);
|
ModelMap redirectAttributes = new RedirectAttributesModelMap(dataBinder);
|
||||||
mavContainer.setRedirectModel(redirectAttributes);
|
mavContainer.setRedirectModel(redirectAttributes);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -89,9 +89,9 @@ public class ServletInvocableHandlerMethod extends InvocableHandlerMethod {
|
||||||
* @param mavContainer the {@link ModelAndViewContainer} for the current request
|
* @param mavContainer the {@link ModelAndViewContainer} for the current request
|
||||||
* @param providedArgs argument values to try to use without the need for view resolution
|
* @param providedArgs argument values to try to use without the need for view resolution
|
||||||
*/
|
*/
|
||||||
public final void invokeAndHandle(NativeWebRequest request,
|
public final void invokeAndHandle(
|
||||||
ModelAndViewContainer mavContainer,
|
NativeWebRequest request, ModelAndViewContainer mavContainer,
|
||||||
Object...providedArgs) throws Exception {
|
Object... providedArgs) throws Exception {
|
||||||
|
|
||||||
Object returnValue = invokeForRequest(request, mavContainer, providedArgs);
|
Object returnValue = invokeForRequest(request, mavContainer, providedArgs);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -67,10 +67,10 @@ public class ServletRequestMethodArgumentResolver implements HandlerMethodArgume
|
||||||
Reader.class.isAssignableFrom(paramType);
|
Reader.class.isAssignableFrom(paramType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
Class<?> paramType = parameter.getParameterType();
|
Class<?> paramType = parameter.getParameterType();
|
||||||
if (WebRequest.class.isAssignableFrom(paramType)) {
|
if (WebRequest.class.isAssignableFrom(paramType)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -57,10 +57,10 @@ public class ServletResponseMethodArgumentResolver implements HandlerMethodArgum
|
||||||
* to the response. If subsequently the underlying method returns
|
* to the response. If subsequently the underlying method returns
|
||||||
* {@code null}, the request is considered directly handled.
|
* {@code null}, the request is considered directly handled.
|
||||||
*/
|
*/
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
mavContainer.setRequestHandled(true);
|
mavContainer.setRequestHandled(true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -41,10 +41,10 @@ public class UriComponentsBuilderMethodArgumentResolver implements HandlerMethod
|
||||||
return UriComponentsBuilder.class.isAssignableFrom(parameter.getParameterType());
|
return UriComponentsBuilder.class.isAssignableFrom(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||||
return ServletUriComponentsBuilder.fromServletMapping(request);
|
return ServletUriComponentsBuilder.fromServletMapping(request);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,10 +44,11 @@ public class ViewMethodReturnValueHandler implements HandlerMethodReturnValueHan
|
||||||
return View.class.isAssignableFrom(returnType.getParameterType());
|
return View.class.isAssignableFrom(returnType.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue == null) {
|
if (returnValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -45,10 +45,11 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
|
||||||
return (void.class.equals(paramType) || String.class.equals(paramType));
|
return (void.class.equals(paramType) || String.class.equals(paramType));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue == null) {
|
if (returnValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -71,10 +71,11 @@ public abstract class AbstractNamedValueMethodArgumentResolver implements Handle
|
||||||
this.expressionContext = (beanFactory != null) ? new BeanExpressionContext(beanFactory, new RequestScope()) : null;
|
this.expressionContext = (beanFactory != null) ? new BeanExpressionContext(beanFactory, new RequestScope()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Object resolveArgument(MethodParameter parameter,
|
public final Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
Class<?> paramType = parameter.getParameterType();
|
Class<?> paramType = parameter.getParameterType();
|
||||||
|
|
||||||
NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);
|
NamedValueInfo namedValueInfo = getNamedValueInfo(parameter);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -91,10 +91,11 @@ public abstract class AbstractWebArgumentResolverAdapter implements HandlerMetho
|
||||||
* @exception IllegalStateException if the resolved value is not assignable
|
* @exception IllegalStateException if the resolved value is not assignable
|
||||||
* to the method parameter.
|
* to the method parameter.
|
||||||
*/
|
*/
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
Class<?> paramType = parameter.getParameterType();
|
Class<?> paramType = parameter.getParameterType();
|
||||||
Object result = this.adaptee.resolveArgument(parameter, webRequest);
|
Object result = this.adaptee.resolveArgument(parameter, webRequest);
|
||||||
if (result == WebArgumentResolver.UNRESOLVED || !ClassUtils.isAssignableValue(paramType, result)) {
|
if (result == WebArgumentResolver.UNRESOLVED || !ClassUtils.isAssignableValue(paramType, result)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -45,10 +45,11 @@ public class ErrorsMethodArgumentResolver implements HandlerMethodArgumentResolv
|
||||||
return Errors.class.isAssignableFrom(paramType);
|
return Errors.class.isAssignableFrom(paramType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
ModelMap model = mavContainer.getModel();
|
ModelMap model = mavContainer.getModel();
|
||||||
if (model.size() > 0) {
|
if (model.size() > 0) {
|
||||||
int lastIndex = model.size()-1;
|
int lastIndex = model.size()-1;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -42,10 +42,11 @@ public class MapMethodProcessor implements HandlerMethodArgumentResolver, Handle
|
||||||
return Map.class.isAssignableFrom(parameter.getParameterType());
|
return Map.class.isAssignableFrom(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
return mavContainer.getModel();
|
return mavContainer.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,10 +55,11 @@ public class MapMethodProcessor implements HandlerMethodArgumentResolver, Handle
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue == null) {
|
if (returnValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -93,10 +93,11 @@ public class ModelAttributeMethodProcessor implements HandlerMethodArgumentResol
|
||||||
* and the next method parameter is not of type {@link Errors}.
|
* and the next method parameter is not of type {@link Errors}.
|
||||||
* @throws Exception if WebDataBinder initialization fails.
|
* @throws Exception if WebDataBinder initialization fails.
|
||||||
*/
|
*/
|
||||||
public final Object resolveArgument(MethodParameter parameter,
|
public final Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest request,
|
NativeWebRequest request, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
String name = ModelFactory.getNameForParameter(parameter);
|
String name = ModelFactory.getNameForParameter(parameter);
|
||||||
Object target = (mavContainer.containsAttribute(name)) ?
|
Object target = (mavContainer.containsAttribute(name)) ?
|
||||||
mavContainer.getModel().get(name) : createAttribute(name, parameter, binderFactory, request);
|
mavContainer.getModel().get(name) : createAttribute(name, parameter, binderFactory, request);
|
||||||
|
|
@ -190,10 +191,11 @@ public class ModelAttributeMethodProcessor implements HandlerMethodArgumentResol
|
||||||
/**
|
/**
|
||||||
* Add non-null return values to the {@link ModelAndViewContainer}.
|
* Add non-null return values to the {@link ModelAndViewContainer}.
|
||||||
*/
|
*/
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue != null) {
|
if (returnValue != null) {
|
||||||
String name = ModelFactory.getNameForReturnValue(returnValue, returnType);
|
String name = ModelFactory.getNameForReturnValue(returnValue, returnType);
|
||||||
mavContainer.addAttribute(name, returnValue);
|
mavContainer.addAttribute(name, returnValue);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -41,10 +41,11 @@ public class ModelMethodProcessor implements HandlerMethodArgumentResolver, Hand
|
||||||
return Model.class.isAssignableFrom(parameter.getParameterType());
|
return Model.class.isAssignableFrom(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
return mavContainer.getModel();
|
return mavContainer.getModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,10 +53,11 @@ public class ModelMethodProcessor implements HandlerMethodArgumentResolver, Hand
|
||||||
return Model.class.isAssignableFrom(returnType.getParameterType());
|
return Model.class.isAssignableFrom(returnType.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
if (returnValue == null) {
|
if (returnValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -50,10 +50,11 @@ public class RequestHeaderMapMethodArgumentResolver implements HandlerMethodArgu
|
||||||
&& Map.class.isAssignableFrom(parameter.getParameterType());
|
&& Map.class.isAssignableFrom(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
Class<?> paramType = parameter.getParameterType();
|
Class<?> paramType = parameter.getParameterType();
|
||||||
|
|
||||||
if (MultiValueMap.class.isAssignableFrom(paramType)) {
|
if (MultiValueMap.class.isAssignableFrom(paramType)) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -55,10 +55,11 @@ public class RequestParamMapMethodArgumentResolver implements HandlerMethodArgum
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
Class<?> paramType = parameter.getParameterType();
|
Class<?> paramType = parameter.getParameterType();
|
||||||
|
|
||||||
Map<String, String[]> parameterMap = webRequest.getParameterMap();
|
Map<String, String[]> parameterMap = webRequest.getParameterMap();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -36,10 +36,11 @@ public class SessionStatusMethodArgumentResolver implements HandlerMethodArgumen
|
||||||
return SessionStatus.class.equals(parameter.getParameterType());
|
return SessionStatus.class.equals(parameter.getParameterType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
return mavContainer.getSessionStatus();
|
return mavContainer.getSessionStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -65,10 +65,11 @@ public class HandlerMethodArgumentResolverComposite implements HandlerMethodArgu
|
||||||
* Iterate over registered {@link HandlerMethodArgumentResolver}s and invoke the one that supports it.
|
* Iterate over registered {@link HandlerMethodArgumentResolver}s and invoke the one that supports it.
|
||||||
* @exception IllegalStateException if no suitable {@link HandlerMethodArgumentResolver} is found.
|
* @exception IllegalStateException if no suitable {@link HandlerMethodArgumentResolver} is found.
|
||||||
*/
|
*/
|
||||||
public Object resolveArgument(MethodParameter parameter,
|
public Object resolveArgument(
|
||||||
ModelAndViewContainer mavContainer,
|
MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||||
NativeWebRequest webRequest,
|
NativeWebRequest webRequest, WebDataBinderFactory binderFactory)
|
||||||
WebDataBinderFactory binderFactory) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
|
HandlerMethodArgumentResolver resolver = getArgumentResolver(parameter);
|
||||||
Assert.notNull(resolver, "Unknown parameter type [" + parameter.getParameterType().getName() + "]");
|
Assert.notNull(resolver, "Unknown parameter type [" + parameter.getParameterType().getName() + "]");
|
||||||
return resolver.resolveArgument(parameter, mavContainer, webRequest, binderFactory);
|
return resolver.resolveArgument(parameter, mavContainer, webRequest, binderFactory);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -64,10 +64,11 @@ public class HandlerMethodReturnValueHandlerComposite implements HandlerMethodRe
|
||||||
* Iterate over registered {@link HandlerMethodReturnValueHandler}s and invoke the one that supports it.
|
* Iterate over registered {@link HandlerMethodReturnValueHandler}s and invoke the one that supports it.
|
||||||
* @exception IllegalStateException if no suitable {@link HandlerMethodReturnValueHandler} is found.
|
* @exception IllegalStateException if no suitable {@link HandlerMethodReturnValueHandler} is found.
|
||||||
*/
|
*/
|
||||||
public void handleReturnValue(Object returnValue,
|
public void handleReturnValue(
|
||||||
MethodParameter returnType,
|
Object returnValue, MethodParameter returnType,
|
||||||
ModelAndViewContainer mavContainer,
|
ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
|
||||||
NativeWebRequest webRequest) throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
HandlerMethodReturnValueHandler handler = getReturnValueHandler(returnType);
|
HandlerMethodReturnValueHandler handler = getReturnValueHandler(returnType);
|
||||||
Assert.notNull(handler, "Unknown return value type [" + returnType.getParameterType().getName() + "]");
|
Assert.notNull(handler, "Unknown return value type [" + returnType.getParameterType().getName() + "]");
|
||||||
handler.handleReturnValue(returnValue, returnType, mavContainer, webRequest);
|
handler.handleReturnValue(returnValue, returnType, mavContainer, webRequest);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2011 the original author or authors.
|
* Copyright 2002-2012 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -135,9 +135,10 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||||
/**
|
/**
|
||||||
* Get the method argument values for the current request.
|
* Get the method argument values for the current request.
|
||||||
*/
|
*/
|
||||||
private Object[] getMethodArgumentValues(NativeWebRequest request,
|
private Object[] getMethodArgumentValues(
|
||||||
ModelAndViewContainer mavContainer,
|
NativeWebRequest request, ModelAndViewContainer mavContainer,
|
||||||
Object... providedArgs) throws Exception {
|
Object... providedArgs) throws Exception {
|
||||||
|
|
||||||
MethodParameter[] parameters = getMethodParameters();
|
MethodParameter[] parameters = getMethodParameters();
|
||||||
Object[] args = new Object[parameters.length];
|
Object[] args = new Object[parameters.length];
|
||||||
for (int i = 0; i < parameters.length; i++) {
|
for (int i = 0; i < parameters.length; i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue