I amended my URL to be as follows then using the namespace pattern matcher 

/person/name/{id}/test-example

but this now maps the config as /person/name/{id}. How would I get rid of
the {id} bit but still pass the parameter through?

Thanks



Musachy Barroso wrote:
> 
> the namespace matcher, ad the name implies matches parameters only in
> the namespace (the part before the action). To map params after the
> action name, you have to use wildcards. Because this is confusing, we
> introduced the advanced regex patters which will sove all the cases,
> see this:
> 
> http://cwiki.apache.org/confluence/pages/editpage.action?pageId=44247
> 
> all 3 approaches are there with examples.
> musachy
> 
> On Tue, Sep 29, 2009 at 8:20 AM, struts-restful <fshou...@ufi.com> wrote:
>>
>> Ok after some further investigating the problem appears to be when the
>> server
>> is starting up and it is building the namespaceActionConfig map.
>>
>> because my namespace on the action is set to
>> /person/name/test-example/{id}
>> when the action config is created the key is set to
>> /person/name/test-example/{id}. So when I call the url the rest action
>> mapper parses the mapping and creates a namespace of /person/name, and
>> subsequently when it tries to determine the corresponding action config
>> associated with this key nothing is found because on start up it had been
>> mapped to  /person/name/test-example/{id}.
>>
>> When i remove the namespace annotation and type in the url my action is
>> then
>> correctly mapped with  /person/name.
>>
>> So is this a bug or have i missed something in my configuration?
>>
>> thanks in advance
>>
>>
>>
>> struts-restful wrote:
>>>
>>> Thanks for the help and your reply.
>>>
>>> i implemented the named pattern matcher but cant get it to work. I have
>>> the following config in my struts.xml
>>>
>>> <bean type="com.opensymphony.xwork2.util.PatternMatcher"
>>> name="namedVariablePatternMatcher"
>>>       class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/>
>>>
>>>  <constant name="struts.enable.SlashesInActionNames" value="true"/>
>>>  <constant name="struts.patternMatcher"
>>> value="namedVariablePatternMatcher"/>
>>>
>>> On my action I added the namespace annotation for example
>>>
>>> @Namespace("/person/name/test-example/{id}")
>>>
>>> this uses the restActionMapper but does not return a ActionConfig object
>>> with the namespace /person/name and the name test-example. When I
>>> stepped
>>> into this method in the DefaultConfiguration class the action
>>> TestExampleController had not been added to the map when it tries to
>>> find
>>> a config object.
>>>
>>> I then tried the same url but removed the namespace annotation from the
>>> action and typed the url into the browser. This went through the same
>>> code
>>> but this time returned the correct ActionConfig object and the action
>>> executed successfully.
>>>
>>> Am i missing a step somewhere
>>>
>>> All help is appreciated. thanks in advance.
>>>
>>>
>>>
>>> Musachy Barroso wrote:
>>>>
>>>> You want to look at wildcards:
>>>>
>>>> http://struts.apache.org/2.x/docs/wildcard-mappings.html
>>>>
>>>> That feature that Alex is refering to (coined advanced wildcards for
>>>> lack of imagination), is in trunk and has not been released yet.
>>>>
>>>> musachy
>>>>
>>>> On Mon, Sep 28, 2009 at 5:57 AM, Alex Siman <aleksandr.si...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Look here:
>>>>> http://www.nabble.com/parameters-in-url-td25602877.html
>>>>>
>>>>> Restful plugin is not so good as it supposed to be.
>>>>>
>>>>> struts-restful wrote:
>>>>>>
>>>>>> Does anyone know how to get the restful web service to call a method
>>>>>> different to show or edit.
>>>>>>
>>>>>> For example I have the following url
>>>>>>
>>>>>> http://localhost:8080/testeg/my/example/example-count/1/count.xml
>>>>>>
>>>>>> I want this to call the method count in my ExampleCountController.
>>>>>> The
>>>>>> URl
>>>>>> goes to the action and calls the setId method setting the Id 2 but
>>>>>> does
>>>>>> not go to the count method
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/restful-URL-issue-tp25641701p25645156.html
>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/restful-URL-issue-tp25641701p25665119.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/restful-URL-issue-tp25641701p25665541.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to