diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowController.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowController.java index b2b51218..271817c8 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowController.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowController.java @@ -17,6 +17,7 @@ package org.springframework.webflow.mvc; import java.io.IOException; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -154,7 +155,20 @@ public class FlowController extends AbstractController { } protected MutableAttributeMap defaultFlowExecutionInputMap(HttpServletRequest request) { - return new LocalAttributeMap(request.getParameterMap()); + LocalAttributeMap inputMap = new LocalAttributeMap(); + Map parameterMap = request.getParameterMap(); + Iterator it = parameterMap.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + String name = (String) entry.getKey(); + String[] values = (String[]) entry.getValue(); + if (values.length == 1) { + inputMap.put(name, values[0]); + } else { + inputMap.put(name, values); + } + } + return inputMap; } protected ModelAndView defaultHandleFlowOutcome(String flowId, String outcome, AttributeMap endedOutput, diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowHandlerAdapter.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowHandlerAdapter.java index 4d014841..c04af52c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowHandlerAdapter.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/FlowHandlerAdapter.java @@ -16,6 +16,8 @@ package org.springframework.webflow.mvc; import java.io.IOException; +import java.util.Iterator; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -139,7 +141,20 @@ public class FlowHandlerAdapter extends WebApplicationObjectSupport implements H } protected MutableAttributeMap defaultFlowExecutionInputMap(HttpServletRequest request) { - return new LocalAttributeMap(request.getParameterMap()); + LocalAttributeMap inputMap = new LocalAttributeMap(); + Map parameterMap = request.getParameterMap(); + Iterator it = parameterMap.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry entry = (Map.Entry) it.next(); + String name = (String) entry.getKey(); + String[] values = (String[]) entry.getValue(); + if (values.length == 1) { + inputMap.put(name, values[0]); + } else { + inputMap.put(name, values); + } + } + return inputMap; } protected ModelAndView defaultHandleFlowOutcome(String flowId, String outcome, AttributeMap endedOutput, diff --git a/spring-webflow/src/test/java/org/springframework/webflow/mvc/FlowControllerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/mvc/FlowControllerTests.java index 00e210bd..0f254d20 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/mvc/FlowControllerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/mvc/FlowControllerTests.java @@ -179,7 +179,9 @@ public class FlowControllerTests extends TestCase { request.addParameter("ajaxSource", "this"); context.setAjaxRequest(true); context.requestFlowExecutionRedirect(); - executor.launchExecution("foo", new LocalAttributeMap(request.getParameterMap()), context); + LocalAttributeMap inputMap = new LocalAttributeMap(); + inputMap.put("ajaxSource", "this"); + executor.launchExecution("foo", inputMap, context); FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345"); EasyMock.expectLastCall().andReturn(result); EasyMock.replay(new Object[] { executor });