mirror of
https://github.com/apache/struts.git
synced 2026-08-07 15:46:57 +00:00
WW-3997 Reverts logic regarding empty action name to allow UnknownHandler work
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1459645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -295,8 +295,7 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
*
|
||||
* @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest)
|
||||
*/
|
||||
public ActionMapping getMapping(HttpServletRequest request,
|
||||
ConfigurationManager configManager) {
|
||||
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
|
||||
ActionMapping mapping = new ActionMapping();
|
||||
String uri = getUri(request);
|
||||
|
||||
@@ -309,22 +308,13 @@ public class DefaultActionMapper implements ActionMapper {
|
||||
}
|
||||
|
||||
parseNameAndNamespace(uri, mapping, configManager);
|
||||
|
||||
handleSpecialParameters(request, mapping);
|
||||
|
||||
// if Action name is empty it can be a request to static resource, return null to handle that case
|
||||
if (StringUtils.isEmpty(mapping.getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
parseActionName(mapping);
|
||||
|
||||
return mapping;
|
||||
return parseActionName(mapping);
|
||||
}
|
||||
|
||||
protected ActionMapping parseActionName(ActionMapping mapping) {
|
||||
if (mapping.getName() == null) {
|
||||
return mapping;
|
||||
return null;
|
||||
}
|
||||
if (allowDynamicMethodCalls) {
|
||||
// handle "name!method" convention.
|
||||
|
||||
+11
-13
@@ -21,17 +21,6 @@
|
||||
|
||||
package org.apache.struts2.dispatcher.mapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
import org.apache.struts2.dispatcher.ServletRedirectResult;
|
||||
import org.apache.struts2.dispatcher.StrutsResultSupport;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
|
||||
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import com.mockobjects.servlet.MockHttpServletRequest;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
@@ -41,6 +30,16 @@ import com.opensymphony.xwork2.config.Configuration;
|
||||
import com.opensymphony.xwork2.config.ConfigurationManager;
|
||||
import com.opensymphony.xwork2.config.entities.PackageConfig;
|
||||
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.StrutsTestCase;
|
||||
import org.apache.struts2.dispatcher.ServletRedirectResult;
|
||||
import org.apache.struts2.dispatcher.StrutsResultSupport;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletRequest;
|
||||
import org.apache.struts2.views.jsp.StrutsMockHttpServletResponse;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DefaultActionMapper test case.
|
||||
@@ -257,8 +256,7 @@ public class DefaultActionMapperTest extends StrutsTestCase {
|
||||
public void testGetMappingWithActionName_null() throws Exception {
|
||||
DefaultActionMapper mapper = new DefaultActionMapper();
|
||||
ActionMapping mapping = mapper.getMappingFromActionName(null);
|
||||
assertEquals(null, mapping.getName());
|
||||
assertEquals(null, mapping.getMethod());
|
||||
assertNull(mapping);
|
||||
}
|
||||
|
||||
public void testGetUri() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user