diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionExecutingViewFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionExecutingViewFactory.java index 8b238eb7..7bb6b124 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionExecutingViewFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionExecutingViewFactory.java @@ -15,9 +15,7 @@ */ package org.springframework.webflow.engine.support; -import java.util.Iterator; - -import org.springframework.webflow.core.collection.ParameterMap; +import org.springframework.web.util.WebUtils; import org.springframework.webflow.engine.ActionExecutor; import org.springframework.webflow.execution.Action; import org.springframework.webflow.execution.Event; @@ -87,51 +85,7 @@ public class ActionExecutingViewFactory implements ViewFactory { } private void determineEventId(RequestContext context) { - eventId = findParameter("_eventId", context.getRequestParameters()); + eventId = WebUtils.findParameterValue(context.getRequestParameters().asMap(), "_eventId"); } - - /** - * Obtain a named parameter from the request parameters. This method will try to obtain a parameter value using - * the following algorithm: - *
null if the parameter does not exist in given request
- */
- private String findParameter(String logicalParameterName, ParameterMap parameters) {
- // first try to get it as a normal name=value parameter
- String value = parameters.get(logicalParameterName);
- if (value != null) {
- return value;
- }
- // if no value yet, try to get it as a name_value=xyz parameter
- String prefix = logicalParameterName + "_";
- Iterator paramNames = parameters.asMap().keySet().iterator();
- while (paramNames.hasNext()) {
- String paramName = (String) paramNames.next();
- if (paramName.startsWith(prefix)) {
- String strValue = paramName.substring(prefix.length());
- // support images buttons, which would submit parameters as
- // name_value.x=123
- if (strValue.endsWith(".x") || strValue.endsWith(".y")) {
- strValue = strValue.substring(0, strValue.length() - 2);
- }
- return strValue;
- }
- }
- // we couldn't find the parameter value
- return null;
- }
-
}
}
\ No newline at end of file
diff --git a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/AbstractMvcView.java b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/AbstractMvcView.java
index 37f86d67..694b460b 100644
--- a/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/AbstractMvcView.java
+++ b/spring-webflow/src/main/java/org/springframework/webflow/mvc/view/AbstractMvcView.java
@@ -46,6 +46,7 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
+import org.springframework.web.util.WebUtils;
import org.springframework.webflow.core.collection.ParameterMap;
import org.springframework.webflow.definition.TransitionDefinition;
import org.springframework.webflow.definition.TransitionableStateDefinition;
@@ -301,50 +302,7 @@ public abstract class AbstractMvcView implements View {
}
private void determineEventId(RequestContext context) {
- eventId = findParameter("_eventId", context.getRequestParameters());
- }
-
- /**
- * Obtain a named parameter from the request parameters. This method will try to obtain a parameter value using the
- * following algorithm:
- * null if the parameter does not exist in given request
- */
- private String findParameter(String logicalParameterName, ParameterMap parameters) {
- // first try to get it as a normal name=value parameter
- String value = parameters.get(logicalParameterName);
- if (value != null) {
- return value;
- }
- // if no value yet, try to get it as a name_value=xyz parameter
- String prefix = logicalParameterName + "_";
- Iterator paramNames = parameters.asMap().keySet().iterator();
- while (paramNames.hasNext()) {
- String paramName = (String) paramNames.next();
- if (paramName.startsWith(prefix)) {
- String strValue = paramName.substring(prefix.length());
- // support images buttons, which would submit parameters as
- // name_value.x=123
- if (strValue.endsWith(".x") || strValue.endsWith(".y")) {
- strValue = strValue.substring(0, strValue.length() - 2);
- }
- return strValue;
- }
- }
- // we couldn't find the parameter value
- return null;
+ eventId = WebUtils.findParameterValue(context.getRequestParameters().asMap(), "_eventId");
}
private static class PropertyNotFoundError implements MappingResultsCriteria {