You are correct, #3 isn't possible right now with the rest plugin, however, it is certainly on the near-term roadmap. What is needed is the ability to define wildcards in the namespace, also known as url templates. For example, you could do something like @Namespace("/states/{state}") on your CitiesController class.
That feature won't be in Struts 2.1.0 (to be released very soon), since it will require changes to XWork and 2.1.0 uses the released XWork 2.1.0, however, I do plan to have it in XWork trunk in the next few days. The original Restful2ActionMapper will work with #3, but not #1 as it will require "/states/" instead of "/states". That, and it is kinda hard to use, IMO, requiring a strange incantation of configuration (and I wrote a good bit of it). Don On 10/26/07, Jeromy Evans <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to setup action mappings for URLs similar to the examples below: > > 1. GET: /states => action = StatesController, method=index() > 2. GET: /states/ca => action = StatesController, method=show(), > params=[id=ca] > 3a. GET: /states/ca/cities/sacramento => action = StatesController, > method=show(), params=[id=ca, cities=sacramento] > OR > 3b. GET: /states/ca/cities/sacramento => action = CitiesController, > method=show(), params=[id=sacramento, states=ca] > > The first two URLs are fine with the struts2-rest-plugin and the > RestActionMapper but I haven't found any combination of namespaces, > packages or Controllers to get 3a or 3b to work as well. > > As far as I can tell from a brief look, the RestActionMapper assumes the > URI consists only of an optional namespace prefix, action name, optional > method and optional id. However the Restful2ActionMapper (which I > haven't used and presume is superseded) does attempt to extract > parameters as described at #3. > > Can anyone suggest how the packages/namespaces/Controllers(Actions) > should be setup to get either 3a or 3b to work with the rest plugin in 2.1? > > Thanks, > Jeromy Evans > > PS. I also couldn't produce anything equivalent using the SmartUrls-0.18 > plugin with 2.0 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]