Author: lukaszlenart
Date: Tue May 28 20:14:15 2013
New Revision: 1487092
URL: http://svn.apache.org/r1487092
Log:
WW-4083 Extends support of ParametersNameAware to pass the same behaviour to
OgnlValueStack
Added:
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/PropertiesJudge.java
Modified:
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/MemberAccessValueStack.java
Modified:
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java?rev=1487092&r1=1487091&r2=1487092&view=diff
==
---
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
(original)
+++
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java
Tue May 28 20:14:15 2013
@@ -22,23 +22,13 @@ import com.opensymphony.xwork2.XWorkCons
import com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ArrayUtils;
-import com.opensymphony.xwork2.util.ClearableValueStack;
-import com.opensymphony.xwork2.util.LocalizedTextUtil;
-import com.opensymphony.xwork2.util.MemberAccessValueStack;
-import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.util.ValueStackFactory;
+import com.opensymphony.xwork2.ognl.PropertiesJudge;
+import com.opensymphony.xwork2.util.*;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -272,7 +262,7 @@ public class ParametersInterceptor exten
protected void addParametersToContext(ActionContext ac, Map newParams) {
}
-protected void setParameters(Object action, ValueStack stack, final
Map parameters) {
+protected void setParameters(final Object action, ValueStack stack, final
Map parameters) {
Map params;
Map acceptableParameters;
if (ordered) {
@@ -313,6 +303,12 @@ public class ParametersInterceptor exten
MemberAccessValueStack accessValueStack = (MemberAccessValueStack)
newStack;
accessValueStack.setAcceptProperties(acceptParams);
accessValueStack.setExcludeProperties(excludeParams);
+if (action instanceof ParameterNameAware)
+accessValueStack.setPropertiesJudge(new PropertiesJudge() {
+public boolean acceptProperty(String propertyName) {
+return ((ParameterNameAware)
action).acceptableParameterName(propertyName);
+}
+});
}
for (Map.Entry entry :
acceptableParameters.entrySet()) {
Modified:
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java?rev=1487092&r1=1487091&r2=1487092&view=diff
==
---
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java
(original)
+++
struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java
Tue May 28 20:14:15 2013
@@ -31,11 +31,7 @@ import com.opensymphony.xwork2.util.logg
import com.opensymphony.xwork2.util.logging.LoggerFactory;
import com.opensymphony.xwork2.util.logging.LoggerUtils;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
-import ognl.NoSuchPropertyException;
-import ognl.Ognl;
-import ognl.OgnlContext;
-import ognl.OgnlException;
-import ognl.PropertyAccessor;
+import ognl.*;
import java.io.Serializable;
import java.util.HashMap;
@@ -463,6 +459,10 @@ public class OgnlValueStack implements S
securityMemberAccess.setAcceptProperties(acceptedProperties);
}
+public void setPropertiesJudge(PropertiesJudge judge) {
+securityMemberAccess.setPropertiesJudge(judge);
+}
+