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

This commit is contained in:
Lukasz Lenart
2016-03-10 08:45:12 +01:00
parent b155532314
commit 609cb0bb97
4 changed files with 19 additions and 7 deletions
@@ -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";
}
}
@@ -1,2 +0,0 @@
<% response.sendRedirect("orders"); %>
@@ -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) {
@@ -63,7 +63,7 @@ public class RestActionMapperTest extends TestCase {
ActionMapping mapping = mapper.getMapping(req, configManager);
assertNull(mapping);
assertNotNull(mapping);
}
public void testGetMapping() throws Exception {