title: Struts 2: root namespace acting same as default namespace
body: <p>In Struts 2 I am seeing the root namespace giving the same behaviour as the root namespace, ie acting as a "catch all".  I need to restrict actions in my app to be accessible from only one URL, including those without a namespace in the URL.  My understanding is using root namespace should do this but I haven't seen it work.</p>
  
  <p>I can reproduce this problem with the Struts 2 tutorial's HelloWorld example for Eclipse available <a href="http://code.google.com/p/struts2-examples/downloads/detail?name=Hello_World_Struts_2_Ant_2_2_1.zip&amp;can=2&amp;q=" rel="nofollow">here</a>.</p>
  
  <p>The struts.xml contains</p>
  
  <pre><code>&lt;package name="basicstruts2" extends="struts-default"&gt;
      ...
      &lt;action name="index"&gt;
          &lt;result&gt;/index.jsp&lt;/result&gt;
      &lt;/action&gt;
      ...
  &lt;/package&gt;
  </code></pre>
  
  <p>So both the following links show the index.jsp result</p>
  
  <ul>
  <li>localhost:8080/Basic_Struts2_Ant/index.action</li>
  <li>localhost:8080/Basic_Struts2_Ant/foo/index.action</li>
  </ul>
  
  <p>Good so far.</p>
  
  <p>If I change the struts.xml to </p>
  
  <pre><code>&lt;package name="basicstruts2" namespace="/foo" extends="struts-default"&gt;
  </code></pre>
  
  <ul>
  <li>localhost:8080/Basic_Struts2_Ant/index.action fails with
  "There is no Action mapped for namespace / and action name index."</li>
  <li>localhost:8080/Basic_Struts2_Ant/foo/index.action shows
  index.jsp</li>
  </ul>
  
  <p>Also good.</p>
  
  <p>Now if I change struts xml to say</p>
  
  <pre><code>&lt;package name="basicstruts2" namespace="/" extends="struts-default"&gt;
  </code></pre>
  
  <p>Both the following links show the index.jsp result (same as when no namespace is defined)</p>
  
  <ul>
  <li>localhost:8080/Basic_Struts2_Ant/index.action</li>
  <li>localhost:8080/Basic_Struts2_Ant/foo/index.action</li>
  </ul>
  
  <p>If I have understood the namespace documentation correctly I would expect
  localhost:8080/Basic_Struts2_Ant/foo/index.action to fail with "There is no Action mapped for namespace /foo and action name index."</p>
  
  <p>I have also tried other variants, replacing "foo" with "alksdja" etc, to eliminate browser caching as a possibility.</p>
  
  <p>Have I misunderstood what the root namespace does?  And how to disable /foo/index.action from working while allowing /index.action?</p>