I'm trying to change the way urls are mapped in Struts 2.
I would like to be able to set up a url like www.site.com/login.action and have it look like www.site.com/action/login
I understand I can remove the action extension using the struts.xml constant
<constant name="struts.action.extension" value="" />
I updated web.xml with the following:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/action/*</url-pattern>
</filter-mapping>
This gives me the results I'm wanting routing all /action/ urls to Struts. The problem is Struts doesn't realize the action part of the url is really the action extension...and of course I wouldn't expect Struts to know that. So in all my Struts.xml action mappings I'm having to include /action in the namespace or even in the action name.
I've seen the PrefixBasedActionMapper class and I'm wondering if I'm on the right track to accomplishing what I'm trying to do...or maybe not...and maybe it's not even possible.
Anyone have some insight into this?