1

I'm new to Struts 2 overall and would like to know, if there is a way to get a list of all the namespaces and actions for each namespace that is defined in the xml?

I have a package and I am including configurations for each namespace:

<include file="struts_someNamespace1.xml" />
<include file="struts_someNamespace2.xml" />
<include file="struts_someNamespace3.xml" />

Each of those XML files is defined similar to this (this has less code):

 <package name="somePackage"  namespace="/someNamespace1" extends="default">
     <action name="firstAction" class="com.someAction">
        <interceptor-ref name="defaultStack"/>
        <interceptor-ref name="json">   </interceptor-ref>
        <result type="json">        </result>
     </action>
     <action name="secondAction" class="com.otherAction">
        <interceptor-ref name="defaultStack"/>
        <interceptor-ref name="json">   </interceptor-ref>
        <result type="json">        </result>
     </action>
 </package>

Is there a way using some utility class where I can get a list or of each namespace and its actions?

Example Results (in JSON)

{
    "someNamespace1": ["firstAction","secondAction"}, 
    "someNamespace2": ["about","home"]
}
Roman C
  • 49,761
  • 33
  • 66
  • 176
SoluableNonagon
  • 11,541
  • 11
  • 53
  • 98

1 Answers1

1

Take a look on the Config Browser plugin, it allows browse (almost) all configuration options.

https://git-wip-us.apache.org/repos/asf?p=struts.git;a=blob;f=plugins/config-browser/src/main/java/org/apache/struts2/config_browser/ConfigurationHelper.java;h=536435f84a7bd818c3051b92fdc94c06cdaa40f6;hb=refs/heads/develop

Lukasz Lenart
  • 987
  • 7
  • 14