[1/7] struts git commit: Upgrades OGNL to the latest version
Repository: struts Updated Branches: refs/heads/master cb5e19723 -> f238cf4f1 Upgrades OGNL to the latest version Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/0bde2716 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/0bde2716 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/0bde2716 Branch: refs/heads/master Commit: 0bde27169a61b9d784ff9bc355d189ba2d3700ea Parents: cb5e197 Author: Lukasz Lenart Authored: Wed May 4 09:06:36 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:06:36 2016 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/0bde2716/pom.xml -- diff --git a/pom.xml b/pom.xml index 8a24fd0..ffd84c1 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ ${project.version} 4.1.6.RELEASE -3.1.2 +3.1.4 3.3 5.0.2 3.0.5
[6/7] struts git commit: Adds additional blocked classes
Adds additional blocked classes Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/016b8eed Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/016b8eed Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/016b8eed Branch: refs/heads/master Commit: 016b8eedd5ca47fce95e2a16069e640e3842906d Parents: 6bd694b Author: Lukasz Lenart Authored: Mon Apr 18 20:38:49 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:19:48 2016 +0200 -- core/src/main/resources/struts-default.xml | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/struts/blob/016b8eed/core/src/main/resources/struts-default.xml -- diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml index 4c1361b..e4090a5 100644 --- a/core/src/main/resources/struts-default.xml +++ b/core/src/main/resources/struts-default.xml @@ -50,6 +50,8 @@ ognl.OgnlContext, ognl.ClassResolver, ognl.TypeConverter, +ognl.MemberAccess, +ognl.DefaultMemberAccess, com.opensymphony.xwork2.ognl.SecurityMemberAccess, com.opensymphony.xwork2.ActionContext" />
[2/7] struts git commit: Introduces more restrictive SMI
Introduces more restrictive SMI Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/9ac863b3 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/9ac863b3 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/9ac863b3 Branch: refs/heads/master Commit: 9ac863b339a3513dabd417f4be8a802418a997ba Parents: 0bde271 Author: Lukasz Lenart Authored: Wed May 4 09:15:06 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:15:06 2016 +0200 -- .../xwork2/config/entities/ActionConfig.java| 16 +-- .../xwork2/config/entities/AllowedMethods.java | 37 +++- .../xwork2/config/impl/ActionConfigMatcher.java | 1 + .../providers/XmlConfigurationProvider.java | 1 + .../config/entities/AllowedMethodsTest.java | 46 +--- 5 files changed, 80 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/9ac863b3/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java -- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java b/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java index e12a86b..3e921f4 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java @@ -44,6 +44,7 @@ public class ActionConfig extends Located implements Serializable { public static final String DEFAULT_METHOD = "execute"; public static final String WILDCARD = "*"; public static final String REGEX_WILDCARD = "regex:.*"; +public static final String DEFAULT_METHOD_REGEX = "([A-Za-z0-9_$]*)"; protected List interceptors; // a list of interceptorMapping Objects eg. List protected Map params; @@ -53,6 +54,7 @@ public class ActionConfig extends Located implements Serializable { protected String methodName; protected String packageName; protected String name; +protected boolean strictMethodInvocation; protected AllowedMethods allowedMethods; protected ActionConfig(String packageName, String name, String className) { @@ -63,7 +65,6 @@ public class ActionConfig extends Located implements Serializable { results = new LinkedHashMap<>(); interceptors = new ArrayList<>(); exceptionMappings = new ArrayList<>(); -allowedMethods = AllowedMethods.build(new HashSet<>(Collections.singletonList(DEFAULT_METHOD))); } /** @@ -80,7 +81,7 @@ public class ActionConfig extends Located implements Serializable { this.interceptors = new ArrayList<>(orig.interceptors); this.results = new LinkedHashMap<>(orig.results); this.exceptionMappings = new ArrayList<>(orig.exceptionMappings); -this.allowedMethods = AllowedMethods.build(orig.allowedMethods.list()); +this.allowedMethods = orig.allowedMethods; this.location = orig.location; } @@ -132,6 +133,10 @@ public class ActionConfig extends Located implements Serializable { return method.equals(methodName != null ? methodName : DEFAULT_METHOD) || allowedMethods.isAllowed(method); } +public boolean isStrictMethodInvocation() { +return strictMethodInvocation; +} + @Override public boolean equals(Object o) { if (this == o) { return true; @@ -328,12 +333,17 @@ public class ActionConfig extends Located implements Serializable { return this; } +public Builder setStrictMethodInvocation(boolean strictMethodInvocation) { +target.strictMethodInvocation = strictMethodInvocation; +return this; +} + public ActionConfig build() { target.params = Collections.unmodifiableMap(target.params); target.results = Collections.unmodifiableMap(target.results); target.interceptors = Collections.unmodifiableList(target.interceptors); target.exceptionMappings = Collections.unmodifiableList(target.exceptionMappings); -target.allowedMethods = AllowedMethods.build(allowedMethods); +target.allowedMethods = AllowedMethods.build(target.strictMethodInvocation, allowedMethods, DEFAULT_METHOD_REGEX); ActionConfig result = target; target = new ActionConfig(target); http://git-wip-us.apache.org/repos/asf/struts/blob/9ac863b3/core/src/main/java/com/opensymphony/xwork2/config/entities/AllowedMethods.java -- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/entities/AllowedMethods.java b/core/src/main/java/com/opensymphony/xwork2/config/ent
[5/7] struts git commit: Drops defining location via request
Drops defining location via request Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/6bd694b7 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/6bd694b7 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/6bd694b7 Branch: refs/heads/master Commit: 6bd694b7980494c12d49ca1bf39f12aec3e03e2f Parents: c9c2137 Author: Lukasz Lenart Authored: Mon Apr 18 20:39:05 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:19:18 2016 +0200 -- .../main/java/org/apache/struts2/views/xslt/XSLTResult.java | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/6bd694b7/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java -- diff --git a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java index 5ebbf67..5dfd5fb 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java @@ -404,12 +404,7 @@ public class XSLTResult implements Result { ServletActionContext.getServletContext()); } -protected Templates getTemplates(String path) throws TransformerException, IOException { -String pathFromRequest = ServletActionContext.getRequest().getParameter("xslt.location"); - -if (pathFromRequest != null) -path = pathFromRequest; - +protected Templates getTemplates(final String path) throws TransformerException, IOException { if (path == null) throw new TransformerException("Stylesheet path is null");
[4/7] struts git commit: Cleans up method name
Cleans up method name Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/c9c21378 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/c9c21378 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/c9c21378 Branch: refs/heads/master Commit: c9c21378f2fb2ff21355c128c45e106ebd87ad7c Parents: 6d7ac40 Author: Lukasz Lenart Authored: Tue Apr 19 08:25:28 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:18:41 2016 +0200 -- .../apache/struts2/dispatcher/mapper/DefaultActionMapper.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/c9c21378/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java -- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java index 95ab0d5..f30e0fd 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java @@ -136,7 +136,7 @@ public class DefaultActionMapper implements ActionMapper { put(METHOD_PREFIX, new ParameterAction() { public void execute(String key, ActionMapping mapping) { if (allowDynamicMethodCalls) { - mapping.setMethod(key.substring(METHOD_PREFIX.length())); + mapping.setMethod(cleanupActionName(key.substring(METHOD_PREFIX.length(; } } }); @@ -148,7 +148,7 @@ public class DefaultActionMapper implements ActionMapper { if (allowDynamicMethodCalls) { int bang = name.indexOf('!'); if (bang != -1) { -String method = name.substring(bang + 1); +String method = cleanupActionName(name.substring(bang + 1)); mapping.setMethod(method); name = name.substring(0, bang); }
[3/7] struts git commit: Cleans up method name
Cleans up method name Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/6d7ac40d Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/6d7ac40d Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/6d7ac40d Branch: refs/heads/master Commit: 6d7ac40dcede1793a4534a3dc249fd562d495e8c Parents: 9ac863b Author: Lukasz Lenart Authored: Fri Apr 29 08:40:03 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:16:44 2016 +0200 -- .../src/main/java/org/apache/struts2/rest/RestActionMapper.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/6d7ac40d/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java -- diff --git a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java index f1fc41a..678a6f3 100644 --- a/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java +++ b/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java @@ -320,7 +320,7 @@ public class RestActionMapper extends DefaultActionMapper { mapping.setName(actionName); if (allowDynamicMethodCalls) { -mapping.setMethod(actionMethod); +mapping.setMethod(cleanupActionName(actionMethod)); } else { mapping.setMethod(null); }
[7/7] struts git commit: Uses isSequence flag to block chained expressions
Uses isSequence flag to block chained expressions Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f238cf4f Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f238cf4f Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f238cf4f Branch: refs/heads/master Commit: f238cf4f1091be19fbcfd086b042c86a1bcaa7fc Parents: 016b8ee Author: Lukasz Lenart Authored: Mon Apr 18 20:38:27 2016 +0200 Committer: Lukasz Lenart Committed: Wed May 4 09:20:04 2016 +0200 -- .../java/com/opensymphony/xwork2/ognl/OgnlUtil.java | 6 +++--- .../com/opensymphony/xwork2/ognl/OgnlUtilTest.java | 15 +++ 2 files changed, 18 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/f238cf4f/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java -- diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java index 679c804..562b6fc 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -287,7 +287,7 @@ public class OgnlUtil { compileAndExecute(name, context, new OgnlTask() { public Void execute(Object tree) throws OgnlException { if (isEvalExpression(tree, context)) { -throw new OgnlException("Eval expression cannot be used as parameter name"); +throw new OgnlException("Eval expression/chained expressions cannot be used as parameter name"); } Ognl.setValue(tree, context, root, value); return null; @@ -303,7 +303,7 @@ public class OgnlUtil { if (context!=null && context instanceof OgnlContext) { ognlContext = (OgnlContext) context; } -return node.isEvalChain(ognlContext); +return node.isEvalChain(ognlContext) || node.isSequence(ognlContext); } return false; } @@ -360,7 +360,7 @@ public class OgnlUtil { private void checkEnableEvalExpression(Object tree, Map context) throws OgnlException { if (!enableEvalExpression && isEvalExpression(tree, context)) { -throw new OgnlException("Eval expressions has been disabled!"); +throw new OgnlException("Eval expressions/chained expressions have been disabled!"); } } http://git-wip-us.apache.org/repos/asf/struts/blob/f238cf4f/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java -- diff --git a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java index 1ccdc4a..339d603 100644 --- a/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/ognl/OgnlUtilTest.java @@ -744,6 +744,21 @@ public class OgnlUtilTest extends XWorkTestCase { assertEquals(expected.getMessage(), "Method \"getRuntime\" failed for object class java.lang.Runtime"); } +public void testBlockSequenceOfExpressions() throws Exception { +Foo foo = new Foo(); + +Exception expected = null; +try { + ognlUtil.setValue("#booScope=@myclass@DEFAULT_SCOPE,#bootScope.init()", ognlUtil.createDefaultContext(foo), foo, true); +fail(); +} catch (OgnlException e) { +expected = e; +} +assertNotNull(expected); +assertSame(OgnlException.class, expected.getClass()); +assertEquals(expected.getMessage(), "Eval expressions/chained expressions have been disabled!"); +} + public static class Email { String address;
[2/2] struts git commit: WW-4630 - generates a value attribute for type=image which violates W3C (cherry picked from commit c4d2b687be8bdb454a11c5376bb475a8fa7f9c67)
WW-4630 - generates a value attribute for type=image which violates W3C (cherry picked from commit c4d2b687be8bdb454a11c5376bb475a8fa7f9c67â) Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/731fde54 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/731fde54 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/731fde54 Branch: refs/heads/support-2-3 Commit: 731fde544c00bcc3933a561848b81374939954aa Parents: 76eb8f3 Author: Aleksandr Mashchenko Authored: Wed May 4 22:54:28 2016 +0300 Committer: Aleksandr Mashchenko Committed: Wed May 4 23:00:33 2016 +0300 -- core/src/main/resources/template/simple/submit.ftl | 6 +++--- .../test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-1.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-2.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-5.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-6.txt | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/main/resources/template/simple/submit.ftl -- diff --git a/core/src/main/resources/template/simple/submit.ftl b/core/src/main/resources/template/simple/submit.ftl index 24db4a8..d77b5d0 100644 --- a/core/src/main/resources/template/simple/submit.ftl +++ b/core/src/main/resources/template/simple/submit.ftl @@ -61,6 +61,9 @@ <#else> +<#if parameters.nameValue?has_content> + value="<@s.property value="parameters.nameValue"/>"<#rt/> + <#if parameters.id?has_content> id="${parameters.id?html}"<#rt/> @@ -68,9 +71,6 @@ <#if parameters.name?has_content> name="${parameters.name?html}"<#rt/> -<#if parameters.nameValue?has_content> - value="<@s.property value="parameters.nameValue"/>"<#rt/> - <#if parameters.disabled!false> disabled="disabled"<#rt/> http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java -- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java index 41f0cc5..c32fb0b 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java @@ -237,7 +237,7 @@ public class SubmitTest extends AbstractUITagTest { tag.doStartTag(); tag.doEndTag(); -assertEquals("", writer.toString().trim()); +assertEquals("", writer.toString().trim()); } /** http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt index 9057dd2..ac308d5 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt index 42e7f1d..ce00b61 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt index b55832d..f9ffb30 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/731fde54/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-6.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-6.txt b/core/src/test/resources/org/apache/struts2/views/j
[1/2] struts git commit: WW-4630 - generates a value attribute for type=image which violates W3C
Repository: struts Updated Branches: refs/heads/master f238cf4f1 -> c4d2b687b refs/heads/support-2-3 76eb8f38a -> 731fde544 WW-4630 - generates a value attribute for type=image which violates W3C Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/c4d2b687 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/c4d2b687 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/c4d2b687 Branch: refs/heads/master Commit: c4d2b687be8bdb454a11c5376bb475a8fa7f9c67 Parents: f238cf4 Author: Aleksandr Mashchenko Authored: Wed May 4 22:54:28 2016 +0300 Committer: Aleksandr Mashchenko Committed: Wed May 4 22:54:28 2016 +0300 -- core/src/main/resources/template/simple/submit.ftl | 6 +++--- .../test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-1.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-2.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-5.txt | 2 +- .../resources/org/apache/struts2/views/jsp/ui/Submit-6.txt | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/main/resources/template/simple/submit.ftl -- diff --git a/core/src/main/resources/template/simple/submit.ftl b/core/src/main/resources/template/simple/submit.ftl index 24db4a8..d77b5d0 100644 --- a/core/src/main/resources/template/simple/submit.ftl +++ b/core/src/main/resources/template/simple/submit.ftl @@ -61,6 +61,9 @@ <#else> +<#if parameters.nameValue?has_content> + value="<@s.property value="parameters.nameValue"/>"<#rt/> + <#if parameters.id?has_content> id="${parameters.id?html}"<#rt/> @@ -68,9 +71,6 @@ <#if parameters.name?has_content> name="${parameters.name?html}"<#rt/> -<#if parameters.nameValue?has_content> - value="<@s.property value="parameters.nameValue"/>"<#rt/> - <#if parameters.disabled!false> disabled="disabled"<#rt/> http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java -- diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java index 2a33037..71fbb14 100644 --- a/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java +++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/SubmitTest.java @@ -232,7 +232,7 @@ public class SubmitTest extends AbstractUITagTest { tag.doStartTag(); tag.doEndTag(); -assertEquals("", writer.toString().trim()); +assertEquals("", writer.toString().trim()); } /** http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt index ef5882c..330df2c 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-1.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt index 36b1554..e4b7c8b 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-2.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt index d83c44f..8632bc0 100644 --- a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt +++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-5.txt @@ -1,3 +1,3 @@ - + http://git-wip-us.apache.org/repos/asf/struts/blob/c4d2b687/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-6.txt -- diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Submit-6.txt
struts git commit: WW-4596 Allows redefine regex used to match methods when SMI is disabled
Repository: struts Updated Branches: refs/heads/master c4d2b687b -> 02b207fca WW-4596 Allows redefine regex used to match methods when SMI is disabled Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/02b207fc Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/02b207fc Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/02b207fc Branch: refs/heads/master Commit: 02b207fca529627f3a34660de86b5161a7d2 Parents: c4d2b68 Author: Lukasz Lenart Authored: Thu May 5 07:33:31 2016 +0200 Committer: Lukasz Lenart Committed: Thu May 5 07:34:04 2016 +0200 -- .../opensymphony/xwork2/config/entities/ActionConfig.java | 9 +++-- .../xwork2/config/impl/DefaultConfiguration.java | 10 ++ .../xwork2/config/providers/XmlConfigurationProvider.java | 2 +- .../src/main/java/org/apache/struts2/StrutsConstants.java | 1 + .../convention/PackageBasedActionConfigBuilder.java | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/struts/blob/02b207fc/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java -- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java b/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java index 3e921f4..1958f53 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/entities/ActionConfig.java @@ -43,7 +43,6 @@ public class ActionConfig extends Located implements Serializable { public static final String DEFAULT_METHOD = "execute"; public static final String WILDCARD = "*"; -public static final String REGEX_WILDCARD = "regex:.*"; public static final String DEFAULT_METHOD_REGEX = "([A-Za-z0-9_$]*)"; protected List interceptors; // a list of interceptorMapping Objects eg. List @@ -218,6 +217,7 @@ public class ActionConfig extends Located implements Serializable { protected ActionConfig target; protected Set allowedMethods; +private String methodRegex; public Builder(ActionConfig toClone) { target = new ActionConfig(toClone); @@ -338,12 +338,17 @@ public class ActionConfig extends Located implements Serializable { return this; } +public Builder setDefaultMethodRegex(String methodRegex) { +this.methodRegex = methodRegex; +return this; +} + public ActionConfig build() { target.params = Collections.unmodifiableMap(target.params); target.results = Collections.unmodifiableMap(target.results); target.interceptors = Collections.unmodifiableList(target.interceptors); target.exceptionMappings = Collections.unmodifiableList(target.exceptionMappings); -target.allowedMethods = AllowedMethods.build(target.strictMethodInvocation, allowedMethods, DEFAULT_METHOD_REGEX); +target.allowedMethods = AllowedMethods.build(target.strictMethodInvocation, allowedMethods, methodRegex != null ? methodRegex : DEFAULT_METHOD_REGEX); ActionConfig result = target; target = new ActionConfig(target); http://git-wip-us.apache.org/repos/asf/struts/blob/02b207fc/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java -- diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java index 1aa45c1..7426831 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java @@ -36,6 +36,7 @@ import ognl.PropertyAccessor; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.struts2.StrutsConstants; import java.util.*; @@ -370,11 +371,20 @@ public class DefaultConfiguration implements Configuration { } } +String methodRegex = container.getInstance(String.class, StrutsConstants.STRUTS_SMI_METHOD_REGEX); +if (methodRegex == null) { +methodRegex = ActionConfig.DEFAULT_METHOD_REGEX; +} + +LOG.debug("Using pattern [{}] to match allowed methods when SMI is disabled!", methodRegex); + return new ActionConfig.Builder(baseConfig) .addParams(params) .addResultConfigs(results) .defaultClassName(packageContext.getDefaultCl