[
https://issues.apache.org/struts/browse/WW-2648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43852#action_43852
]
Rodel T. Viado commented on WW-2648:
------------------------------------
I made a link on the original issue, Don said that he was unable to reproduce
the issue using a test case. Unfortunately the test case did not cover this
specific scenario, see my explanation below:
Your test case does not test if there exist a configured namespace whose value
is "/, for example
config = new DefaultConfiguration();
PackageConfig pkg = new PackageConfig("myRoot", "/", false, null);
config.addPackageConfig("myRoot", pkg);
configManager = new ConfigurationManager() {
public Configuration getConfiguration() {
return config;
}
};
public void testGetMappingWithNamespaceSlash() throws Exception {
req.setupGetRequestURI("/anythingHere/any/abc.action");
req.setupGetServletPath("/anythingHere/any");
req.setupGetAttribute(null);
req.addExpectedGetAttributeName("javax.servlet.include.servlet_path");
mapper = new DefaultActionMapper();
mapper.setSlashesInActionNames("true");
mapping = mapper.getMapping(req, configManager);
//Note that it is expected thet the namespace is "/" not ""
assertEquals("/", mapping.getNamespace());
assertEquals("anythingHere/any/abc", mapping.getName());
}
> SlashesInActionNames does not work when namespace is the root context (i.e.
> namespace="/")
> ------------------------------------------------------------------------------------------
>
> Key: WW-2648
> URL: https://issues.apache.org/struts/browse/WW-2648
> Project: Struts 2
> Issue Type: Bug
> Components: Core Interceptors
> Affects Versions: 2.0.11
> Environment: OS- Fedora
> JDK jdk1.6.0_02
> Servlet container - Tomcat 6.0.14
> Reporter: Rodel T. Viado
> Assignee: Don Brown
>
> Below is a sample config that exhibits the problem. Note that the namespace
> is the root context, it works fine if the namespace is not the root.
> <struts>
> <constant name="struts.enable.SlashesInActionNames" value="true" />
> <package name="login" namespace="/" extends="struts-default">
>
> <action name="sample/Login" class="com.any.LoginAction">
> <result name="input">/login/login.jsp</result>
> <result type="redirect-action">SucessAction</result>
> </action>
> </package>
> </struts>
> Accessing http://localhost/<webAppContext>/sample/Login.action
> Where <webAppContext> is the contextPath of the web application
> Results in an error:
> There is no Action mapped for action name sample/Login. - [unknown location]
> at
> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
> at
> org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
> at
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
> at
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.