mirror of
https://github.com/apache/struts.git
synced 2026-08-06 23:27:07 +00:00
WW-4533 Reverts the old behaviour of how empty action should be handled
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user