Hi,
I have been using struts for an year now and I always thought that expecting
name and namespace of the action in URI is very limiting to application
developers. It makes it very difficult to have actions mapping to UriTemplates
like http://www.example.com/{foo}/{bar}/{baz}. Some times (as in my case), you
might require a completely custom strategy of mapping uri to actions. To solve
both these issues, I have written a simple plugin called. UriMapperPlugin. It
is not well tested yet (frankly I do not even have unit tests.. thats a shame
..), but I wanted to verify if I am thinking on the correct lines.
I have a package provider registered.
(com.opensymphony.xwork2.config.PackageProvider bean), that does following
1. Registers itself with Dispatcher for dispatcherInitialized event.2. In
dispatcherInitialized, iterates through all the action configurations to get
ActionMappingRule annotations ( see attached code). and keeps a map of action
name and namespace to ActionMapper objects.3. It defines an ActionMapper
which gets a reference to this package provider bean and iterates through all
the rules to match http request.
I have shared the code at http://code.google.com/p/urimapperplugin/
I will like to get comments and like to know if I am missing something obvious.
Thanks,Unmesh
_________________________________________________________________
South Cinema This Decade
http://entertainment.in.msn.com/southcinemathisdecade/