revised @RequestParam processing to support CSV-to-array/collection binding with ConversionService (SPR-7479)

This commit is contained in:
Juergen Hoeller 2010-09-08 12:39:57 +00:00
parent 449337a544
commit a251d6a6cc
1 changed files with 2 additions and 12 deletions

View File

@ -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) {