revised @RequestParam processing to support CSV-to-array/collection binding with ConversionService (SPR-7479)
This commit is contained in:
parent
449337a544
commit
a251d6a6cc
|
|
@ -484,23 +484,13 @@ public class HandlerMethodInvoker {
|
||||||
if (multipartRequest != null) {
|
if (multipartRequest != null) {
|
||||||
List<MultipartFile> files = multipartRequest.getFiles(paramName);
|
List<MultipartFile> files = multipartRequest.getFiles(paramName);
|
||||||
if (!files.isEmpty()) {
|
if (!files.isEmpty()) {
|
||||||
if (files.size() == 1 && !paramType.isArray() && !Collection.class.isAssignableFrom(paramType)) {
|
paramValue = (files.size() == 1 ? files.get(0) : files);
|
||||||
paramValue = files.get(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
paramValue = files;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paramValue == null) {
|
if (paramValue == null) {
|
||||||
String[] paramValues = webRequest.getParameterValues(paramName);
|
String[] paramValues = webRequest.getParameterValues(paramName);
|
||||||
if (paramValues != null) {
|
if (paramValues != null) {
|
||||||
if (paramValues.length == 1 && !paramType.isArray() && !Collection.class.isAssignableFrom(paramType)) {
|
paramValue = (paramValues.length == 1 ? paramValues[0] : paramValues);
|
||||||
paramValue = paramValues[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
paramValue = paramValues;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paramValue == null) {
|
if (paramValue == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue