struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pligh...@apache.org
Subject svn commit: r436991 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/components/Form.java test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
Date Fri, 25 Aug 2006 22:30:38 GMT
Author: plightbo
Date: Fri Aug 25 15:30:36 2006
New Revision: 436991

URL: http://svn.apache.org/viewvc?rev=436991&view=rev
Log:
nuking the compatibility mode stuff that disabled the ! and method: support for the time being.
we'll come up with a more secure option (probably annotation) soon. (tests pass now too)

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Form.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java

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=436991&r1=436990&r2=436991&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 Fri Aug
25 15:30:36 2006
@@ -223,9 +223,12 @@
         }
 
         String actionMethod = "";
-        int endIdx = action.lastIndexOf("!");
-        actionMethod = action.substring(endIdx + 1, action.length());
-        action = action.substring(0, endIdx);
+        // 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);
+        }
 
         Configuration config = Dispatcher.getInstance().getConfigurationManager().getConfiguration();
         final ActionConfig actionConfig = config.getRuntimeConfiguration().getActionConfig(namespace,
action);

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java?rev=436991&r1=436990&r2=436991&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapperTest.java
Fri Aug 25 15:30:36 2006
@@ -79,7 +79,8 @@
         ActionMapping mapping = mapper.getMapping(req, config);
 
         assertEquals("/my/namespace", mapping.getNamespace());
-        assertEquals("actionName!add", mapping.getName());
+        assertEquals("actionName", mapping.getName());
+        assertEquals("add", mapping.getMethod());
     }
     
     public void testGetMappingWithSlashedName() throws Exception {
@@ -266,7 +267,7 @@
         actionMapping.setNamespace("/myNamespace");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myNamespace/myActionName.action", uri);
+        assertEquals("/myNamespace/myActionName!myMethod.action", uri);
     }
 
     public void testGetUriFromActionMapper2() throws Exception {
@@ -277,7 +278,7 @@
         actionMapping.setNamespace("/");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myActionName.action", uri);
+        assertEquals("/myActionName!myMethod.action", uri);
     }
 
     public void testGetUriFromActionMapper3() throws Exception {
@@ -288,7 +289,7 @@
         actionMapping.setNamespace("");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myActionName.action", uri);
+        assertEquals("/myActionName!myMethod.action", uri);
     }
 
 
@@ -321,7 +322,7 @@
         actionMapping.setNamespace("/myNamespace");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myNamespace/myActionName.action?test=bla", uri);
+        assertEquals("/myNamespace/myActionName!myMethod.action?test=bla", uri);
     }
 
     public void testGetUriFromActionMapper7() throws Exception {
@@ -332,7 +333,7 @@
         actionMapping.setNamespace("/");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myActionName.action?test=bla", uri);
+        assertEquals("/myActionName!myMethod.action?test=bla", uri);
     }
 
     public void testGetUriFromActionMapper8() throws Exception {
@@ -343,7 +344,7 @@
         actionMapping.setNamespace("");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myActionName.action?test=bla", uri);
+        assertEquals("/myActionName!myMethod.action?test=bla", uri);
     }
 
 
@@ -374,7 +375,7 @@
         actionMapping.setNamespace("/");
         String uri = mapper.getUriFromActionMapping(actionMapping);
 
-        assertEquals("/myActionName.action.action", uri);
+        assertEquals("/myActionName.action", uri);
     }
     
     public void testGetUriFromActionMapper12() throws Exception {



Mime
View raw message