struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject struts git commit: WW-4533 Reverts the old behaviour of how empty action should be handled
Date Thu, 10 Mar 2016 07:45:26 GMT
Repository: struts
Updated Branches:
  refs/heads/support-2-3 b15553231 -> 609cb0bb9


WW-4533 Reverts the old behaviour of how empty action should be handled


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/609cb0bb
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/609cb0bb
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/609cb0bb

Branch: refs/heads/support-2-3
Commit: 609cb0bb971db3fe84778188b6c1f77bf5d38fe2
Parents: b155532
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Thu Mar 10 08:45:12 2016 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Thu Mar 10 08:45:12 2016 +0100

----------------------------------------------------------------------
 .../java/org/demo/rest/example/IndexController.java | 16 ++++++++++++++++
 apps/rest-showcase/src/main/webapp/index.jsp        |  2 --
 .../org/apache/struts2/rest/RestActionMapper.java   |  6 ++----
 .../apache/struts2/rest/RestActionMapperTest.java   |  2 +-
 4 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/609cb0bb/apps/rest-showcase/src/main/java/org/demo/rest/example/IndexController.java
----------------------------------------------------------------------
diff --git a/apps/rest-showcase/src/main/java/org/demo/rest/example/IndexController.java b/apps/rest-showcase/src/main/java/org/demo/rest/example/IndexController.java
new file mode 100644
index 0000000..0e6d403
--- /dev/null
+++ b/apps/rest-showcase/src/main/java/org/demo/rest/example/IndexController.java
@@ -0,0 +1,16 @@
+package org.demo.rest.example;
+
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.Results;
+
+@Results({
+    @Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
+})
+public class IndexController {
+
+    @Action("/")
+    public String index() {
+        return "success";
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/609cb0bb/apps/rest-showcase/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/apps/rest-showcase/src/main/webapp/index.jsp b/apps/rest-showcase/src/main/webapp/index.jsp
deleted file mode 100644
index 7e3fc9d..0000000
--- a/apps/rest-showcase/src/main/webapp/index.jsp
+++ /dev/null
@@ -1,2 +0,0 @@
-
-<% response.sendRedirect("orders"); %>

http://git-wip-us.apache.org/repos/asf/struts/blob/609cb0bb/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 00d58f5..12cc9d0 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
@@ -283,7 +283,7 @@ public class RestActionMapper extends DefaultActionMapper {
             if (id != null) {
                 if (!"new".equals(id)) {
                     if (mapping.getParams() == null) {
-                        mapping.setParams(new HashMap());
+                        mapping.setParams(new HashMap<String, Object>());
                     }
                     mapping.getParams().put(idParameterName, new String[]{id});
                 }
@@ -291,10 +291,8 @@ public class RestActionMapper extends DefaultActionMapper {
             }
 
             mapping.setName(fullName);
-            return mapping;
         }
-        // if action name isn't specified, it can be a normal request, to static resource,
return null to allow handle that case
-        return null;
+        return mapping;
     }
 
     private void handleDynamicMethodInvocation(ActionMapping mapping, String name) {

http://git-wip-us.apache.org/repos/asf/struts/blob/609cb0bb/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
----------------------------------------------------------------------
diff --git a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
index 3de37d4..42d2518 100644
--- a/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
+++ b/plugins/rest/src/test/java/org/apache/struts2/rest/RestActionMapperTest.java
@@ -63,7 +63,7 @@ public class RestActionMapperTest extends TestCase {
 
         ActionMapping mapping = mapper.getMapping(req, configManager);
 
-        assertNull(mapping);
+        assertNotNull(mapping);
     }
 
     public void testGetMapping() throws Exception {


Mime
View raw message