Author: husted
Date: Tue Aug 29 09:51:55 2006
New Revision: 438114

URL: http://svn.apache.org/viewvc?rev=438114&view=rev
Log:
WW-1353 Complete rollback of r436971 and r436991, using new property name and 
enabling behavior by default. Update affected applications. (And release notes.)

Modified:
    struts/sandbox/trunk/struts2/apps/mailreader-bang/README.txt
    
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.properties
    
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.xml
    struts/struts2/trunk/   (props changed)
    struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties
    struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
    
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
    
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java

Modified: struts/sandbox/trunk/struts2/apps/mailreader-bang/README.txt
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/mailreader-bang/README.txt?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2/apps/mailreader-bang/README.txt (original)
+++ struts/sandbox/trunk/struts2/apps/mailreader-bang/README.txt Tue Aug 29 
09:51:55 2006
@@ -1,16 +1,15 @@
 README.txt - mailreader-bang 
 
-This application demonstrates switching form the "bang" syntax for invoking 
+This application demonstrates switching from the "bang" syntax for invoking
 dynamic methods to a general-purpose wild card approach. 
 
 To switch between approaches, edit the struts.xml file to include either the 
 struts-bang.xml file OR the struts-wildcard.xml. (But not both.)
 
 When using the -bang application, be sure that the 
-disableDynamicMethodInvocation property is set to false. 
+struts.enable.DynamicMethodInvocation property is set to "true".
 
 For the -wilcard application. be sure that the 
-disableDynamicMethodInvocation property is set to true.
-
+struts.enable.DynamicMethodInvocation property is set to "false". 
 
 ----------------------------------------------------------------------------

Modified: 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.properties
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.properties?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.properties
 (original)
+++ 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.properties
 Tue Aug 29 09:51:55 2006
@@ -2,5 +2,4 @@
 struts.devMode = true
 struts.action.extension = do
 struts.custom.i18n.resources = resources
-struts.compatibilityMode.WebWork = false
-
+struts.enable.DynamicMethodInvocation = false

Modified: 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.xml
URL: 
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.xml?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.xml 
(original)
+++ 
struts/sandbox/trunk/struts2/apps/mailreader-bang/src/main/resources/struts.xml 
Tue Aug 29 09:51:55 2006
@@ -12,7 +12,6 @@
     <!--
     <include file="struts-bang.xml"/>
     -->
-
     <include file="struts-wildcard.xml"/>
 
 </struts>

Propchange: struts/struts2/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Aug 29 09:51:55 2006
@@ -2,3 +2,4 @@
 *.iml
 *.iws
 *.ipr
+lib

Modified: 
struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties 
(original)
+++ struts/struts2/trunk/apps/mailreader/src/main/resources/struts.properties 
Tue Aug 29 09:51:55 2006
@@ -1,3 +1,4 @@
 struts.objectFactory = spring
 struts.devMode = true
 struts.custom.i18n.resources = resources
+struts.enable.DynamicMethodInvocation = false

Modified: 
struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties 
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties Tue 
Aug 29 09:51:55 2006
@@ -9,4 +9,3 @@
 struts.freemarker.manager.classname=customFreemarkerManager
 struts.serve.static=true
 struts.serve.static.browserCache=false
-struts.compatibilityMode.WebWork = true

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
(original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java 
Tue Aug 29 09:51:55 2006
@@ -123,5 +123,5 @@
     public static final String STRUTS_SERVE_STATIC_BROWSER_CACHE = 
"struts.serve.static.browserCache";
 
     /** Allows one to disable dynamic method invocation from the URL */
-    public static final String STRUTS_DISABLE_DYNAMIC_METHOD_INVOCATION = 
"struts.core.disableDynamicMethodInvocation";
+    public static final String STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION = 
"struts.enable.DynamicMethodInvocation";
 }

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
 Tue Aug 29 09:51:55 2006
@@ -27,6 +27,7 @@
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsException;
+import org.apache.struts2.config.Settings;
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.apache.struts2.dispatcher.RequestMap;
 import org.apache.struts2.views.jsp.TagUtils;
@@ -168,6 +169,8 @@
      * @see org.apache.struts2.views.jsp.TagUtils#buildNamespace
      */
     private void executeAction() {
+        // FIXME: our implementation is flawed - the only concept of ! should 
be in DefaultActionMapper
+        boolean allowDynamicMethodCalls = 
"true".equals(Settings.get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION));
         String actualName = findString(name, "name", "Action name is required. 
Example: updatePerson");
 
         if (actualName == null) {
@@ -178,10 +181,12 @@
         String methodName = null;
 
         // handle "name!method" convention.
-        int exclamation = actualName.lastIndexOf("!");
-        if (exclamation != -1) {
-            actionName = actualName.substring(0, exclamation);
-            methodName = actualName.substring(exclamation + 1);
+        if (allowDynamicMethodCalls) {
+            int exclamation = actualName.lastIndexOf("!");
+            if (exclamation != -1) {
+                actionName = actualName.substring(0, exclamation);
+                methodName = actualName.substring(exclamation + 1);
+            }
         }
 
         String namespace;

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java 
(original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java 
Tue Aug 29 09:51:55 2006
@@ -32,6 +32,7 @@
 import com.opensymphony.xwork2.validator.Validator;
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.config.Settings;
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.apache.struts2.dispatcher.mapper.ActionMapperFactory;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
@@ -223,11 +224,16 @@
         }
 
         String actionMethod = "";
-        // todo: this logic is flawed - the only concept of ! should be in 
DefaultActionMapper
-        if (action.indexOf("!") != -1) {
-            int endIdx = action.lastIndexOf("!");
-            actionMethod = action.substring(endIdx + 1, action.length());
-            action = action.substring(0, endIdx);
+        // FIXME: our implementation is flawed - the only concept of ! should 
be in DefaultActionMapper
+        boolean allowDynamicMethodCalls = 
"true".equals(Settings.get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION));
+
+        // handle "name!method" convention.
+        if (allowDynamicMethodCalls) {
+            if (action.indexOf("!") != -1) {
+                int endIdx = action.lastIndexOf("!");
+                actionMethod = action.substring(endIdx + 1, action.length());
+                action = action.substring(0, endIdx);
+            }
         }
 
         Configuration config = 
Dispatcher.getInstance().getConfigurationManager().getConfiguration();

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UpDownSelect.java
 Tue Aug 29 09:51:55 2006
@@ -148,7 +148,7 @@
                        ancestorForm.getParameters().put("updownselectIds", m);
                }
                else {
-                       _log.warn("no ancestor form found for updownselect 
"+this+", therefore autoselect of all elements unpon form submission will not 
work ");
+                       _log.warn("no ancestor form found for updownselect 
"+this+", therefore autoselect of all elements upon form submission will not 
work ");
                }
        }
 

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java
 Tue Aug 29 09:51:55 2006
@@ -149,7 +149,7 @@
     static final String REDIRECT_PREFIX = "redirect:";
     static final String REDIRECT_ACTION_PREFIX = "redirect-action:";
 
-    private static boolean disableDynamicMethodCalls = 
"true".equals(Settings.get(StrutsConstants.STRUTS_SERVE_STATIC_BROWSER_CACHE));
+    private static boolean allowDynamicMethodCalls = 
"true".equals(Settings.get(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION));
 
     private PrefixTrie prefixTrie = null;
     public DefaultActionMapper() {
@@ -208,7 +208,7 @@
 
         parseNameAndNamespace(uri, mapping, config);
 
-        if (!disableDynamicMethodCalls) {
+        if (allowDynamicMethodCalls) {
             handleSpecialParameters(request, mapping);
         }
 
@@ -216,7 +216,7 @@
             return null;
         }
 
-        if (!disableDynamicMethodCalls) {
+        if (allowDynamicMethodCalls) {
             // handle "name!method" convention.
             String name = mapping.getName();
             int exclamation = name.lastIndexOf("!");

Modified: 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
 (original)
+++ 
struts/struts2/trunk/core/src/main/resources/org/apache/struts2/default.properties
 Tue Aug 29 09:51:55 2006
@@ -71,10 +71,10 @@
 ###            headers)
 struts.serve.static.browserCache=true
 
-### Set this to true if you wish to disable all forms of dynamic method 
invocation
+### Set this to false if you wish to disable all forms of dynamic method 
invocation
 ### via the URL request. This includes URLs like foo!bar.action, as well as 
params
 ### like method:bar. See the DefaultActionMapper for more info.
-struts.core.disableDynamicMethodInvocation = false
+struts.enable.DynamicMethodInvocation = true
 
 ### use alternative syntax that requires %{} in most places
 ### to evaluate expressions for String attributes for tags

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java?rev=438114&r1=438113&r2=438114&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
 Tue Aug 29 09:51:55 2006
@@ -193,6 +193,7 @@
         }
     }
 
+    // FIXME: Logging the error seems to cause the standard Maven build to fail
     public void testUnknownNameDefined() throws Exception {
         ActionTag tag = new ActionTag();
         tag.setPageContext(pageContext);
@@ -202,11 +203,10 @@
 
         tag.doStartTag();
         tag.doEndTag();
-        // will just log it to ERROR but we run th code to test that it works 
somehow
+        // will just log it to ERROR but we run the code to test that it works 
somehow
     }
 
-    // TODO - !input form fails in Maven, but passes in IDEA. The settings 
seem to be ignored under Maven.
-    public void FIXME_testActionMethodWithExecuteResult() throws Exception {
+    public void testActionMethodWithExecuteResult() throws Exception {
         ActionTag tag = new ActionTag();
         tag.setPageContext(pageContext);
         tag.setNamespace("");


Reply via email to