You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by struts-restful <fs...@ufi.com> on 2009/09/28 11:17:06 UTC

restful URL issue

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-tp25641701p25641701.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: restful URL issue

Posted by Musachy Barroso <mu...@gmail.com>.
I think it would be save to say that you might have to use xml mapping
for those actions. When adding the "advanced wildards" I found some
problem in convention, which are now fixed in trunk. If you are
comfortable building struts, you might five it a try.

musahcy

On Wed, Sep 30, 2009 at 6:38 AM, struts-restful <fs...@ufi.com> wrote:
>
> Is a possible reason that it may not be working that I am also using the
> convention plugin??
>
>
> struts-restful wrote:
>>
>> I also tried this with a / in the namespace so
>>
>> @Namespace("test/{id}"} and
>> @Namespace("/test/{id}"} give a namespace with "".
>>
>>
>>
>> struts-restful wrote:
>>>
>>> One more additional piece of information is that the namespaceMatcher
>>> does contain the compiled pattern for my namespace.
>>>
>>> Another thing I noticed when messing around trying to figure this out is
>>> that I created a different controller class ain a different package for
>>> example test.MyTestController.
>>>
>>> when I tried the URL /test/-1/my-test.xml my namespace was set to "" and
>>> my actionname was = "test" and methodname was populated with "my-test".
>>> This is if I had a namespace annotation as follows
>>>
>>> @Namespace("test/{id}"}
>>> public class MyTestController
>>>
>>> Thanks in advance
>>>
>>>
>>>
>>> struts-restful wrote:
>>>>
>>>> Yes I am putting it in the namespace annotation
>>>>
>>>> @Namespace("/person/name/test-example/{id}")
>>>>
>>>> Stepping through the namespace pattern matcher code it does replace the
>>>> {id} with ([^/]+) but that is as far as i have got and still dont
>>>> understand why it does not work
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>>
>>>> Musachy Barroso wrote:
>>>>>
>>>>> are you putting that in the @Namespace annotation? It will not work on
>>>>> the @Action annotation.
>>>>>
>>>>> musachy
>>>>>
>>>>> On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com>
>>>>> wrote:
>>>>>>
>>>>>> Also I know that the default parameter is id but ideally i am trying
>>>>>> to
>>>>>> create a url as follows
>>>>>>
>>>>>> /person/name/{id}/{anotherId}/test-example
>>>>>>
>>>>>>
>>>>>> struts-restful wrote:
>>>>>>>
>>>>>>> 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 <fs...@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
>>>>>>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
>>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/restful-URL-issue-tp25641701p25681237.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
Is a possible reason that it may not be working that I am also using the
convention plugin??


struts-restful wrote:
> 
> I also tried this with a / in the namespace so 
> 
> @Namespace("test/{id}"} and 
> @Namespace("/test/{id}"} give a namespace with "".
> 
> 
> 
> struts-restful wrote:
>> 
>> One more additional piece of information is that the namespaceMatcher
>> does contain the compiled pattern for my namespace. 
>> 
>> Another thing I noticed when messing around trying to figure this out is
>> that I created a different controller class ain a different package for
>> example test.MyTestController. 
>> 
>> when I tried the URL /test/-1/my-test.xml my namespace was set to "" and
>> my actionname was = "test" and methodname was populated with "my-test".
>> This is if I had a namespace annotation as follows 
>> 
>> @Namespace("test/{id}"}
>> public class MyTestController
>> 
>> Thanks in advance
>> 
>> 
>> 
>> struts-restful wrote:
>>> 
>>> Yes I am putting it in the namespace annotation 
>>> 
>>> @Namespace("/person/name/test-example/{id}") 
>>> 
>>> Stepping through the namespace pattern matcher code it does replace the
>>> {id} with ([^/]+) but that is as far as i have got and still dont
>>> understand why it does not work
>>> 
>>> Thanks in advance
>>> 
>>> 
>>> 
>>> Musachy Barroso wrote:
>>>> 
>>>> are you putting that in the @Namespace annotation? It will not work on
>>>> the @Action annotation.
>>>> 
>>>> musachy
>>>> 
>>>> On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com>
>>>> wrote:
>>>>>
>>>>> Also I know that the default parameter is id but ideally i am trying
>>>>> to
>>>>> create a url as follows
>>>>>
>>>>> /person/name/{id}/{anotherId}/test-example
>>>>>
>>>>>
>>>>> struts-restful wrote:
>>>>>>
>>>>>> 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 <fs...@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
>>>>>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

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


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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
I also tried this with a / in the namespace so 

@Namespace("test/{id}"} and 
@Namespace("/test/{id}"} give a namespace with "".



struts-restful wrote:
> 
> One more additional piece of information is that the namespaceMatcher does
> contain the compiled pattern for my namespace. 
> 
> Another thing I noticed when messing around trying to figure this out is
> that I created a different controller class ain a different package for
> example test.MyTestController. 
> 
> when I tried the URL /test/-1/my-test.xml my namespace was set to "" and
> my actionname was = "test" and methodname was populated with "my-test".
> This is if I had a namespace annotation as follows 
> 
> @Namespace("test/{id}"}
> public class MyTestController
> 
> Thanks in advance
> 
> 
> 
> struts-restful wrote:
>> 
>> Yes I am putting it in the namespace annotation 
>> 
>> @Namespace("/person/name/test-example/{id}") 
>> 
>> Stepping through the namespace pattern matcher code it does replace the
>> {id} with ([^/]+) but that is as far as i have got and still dont
>> understand why it does not work
>> 
>> Thanks in advance
>> 
>> 
>> 
>> Musachy Barroso wrote:
>>> 
>>> are you putting that in the @Namespace annotation? It will not work on
>>> the @Action annotation.
>>> 
>>> musachy
>>> 
>>> On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com>
>>> wrote:
>>>>
>>>> Also I know that the default parameter is id but ideally i am trying to
>>>> create a url as follows
>>>>
>>>> /person/name/{id}/{anotherId}/test-example
>>>>
>>>>
>>>> struts-restful wrote:
>>>>>
>>>>> 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 <fs...@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
>>>>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

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


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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
One more additional piece of information is that the namespaceMatcher does
contain the compiled pattern for my namespace. 

Another thing I noticed when messing around trying to figure this out is
that I created a different controller class ain a different package for
example test.MyTestController. 

when I tried the URL /test/-1/my-test.xml my namespace was set to "" and my
actionname was = "test" and methodname was populated with "my-test". This is
if I had a namespace annotation as follows 

@Namespace("test/{id}"}
public class MyTestController

Thanks in advance



struts-restful wrote:
> 
> Yes I am putting it in the namespace annotation 
> 
> @Namespace("/person/name/test-example/{id}") 
> 
> Stepping through the namespace pattern matcher code it does replace the
> {id} with ([^/]+) but that is as far as i have got and still dont
> understand why it does not work
> 
> Thanks in advance
> 
> 
> 
> Musachy Barroso wrote:
>> 
>> are you putting that in the @Namespace annotation? It will not work on
>> the @Action annotation.
>> 
>> musachy
>> 
>> On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com> wrote:
>>>
>>> Also I know that the default parameter is id but ideally i am trying to
>>> create a url as follows
>>>
>>> /person/name/{id}/{anotherId}/test-example
>>>
>>>
>>> struts-restful wrote:
>>>>
>>>> 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 <fs...@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
>>>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

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


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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
Yes I am putting it in the namespace annotation 

@Namespace("/person/name/test-example/{id}") 

Stepping through the namespace pattern matcher code it does replace the {id}
with ([^/]+) but that is as far as i have got and still dont understand why
it does not work

Thanks in advance



Musachy Barroso wrote:
> 
> are you putting that in the @Namespace annotation? It will not work on
> the @Action annotation.
> 
> musachy
> 
> On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com> wrote:
>>
>> Also I know that the default parameter is id but ideally i am trying to
>> create a url as follows
>>
>> /person/name/{id}/{anotherId}/test-example
>>
>>
>> struts-restful wrote:
>>>
>>> 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 <fs...@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
>>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

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


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


Re: restful URL issue

Posted by Musachy Barroso <mu...@gmail.com>.
are you putting that in the @Namespace annotation? It will not work on
the @Action annotation.

musachy

On Tue, Sep 29, 2009 at 8:49 AM, struts-restful <fs...@ufi.com> wrote:
>
> Also I know that the default parameter is id but ideally i am trying to
> create a url as follows
>
> /person/name/{id}/{anotherId}/test-example
>
>
> struts-restful wrote:
>>
>> 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 <fs...@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
>>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/restful-URL-issue-tp25641701p25665572.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
Also I know that the default parameter is id but ideally i am trying to
create a url as follows 

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


struts-restful wrote:
> 
> 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 <fs...@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
>>>>> <al...@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-unsubscribe@struts.apache.org
>>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

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


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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
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 <fs...@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 <al...@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-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: restful URL issue

Posted by Musachy Barroso <mu...@gmail.com>.
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 <fs...@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 <al...@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-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
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 <al...@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-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: restful URL issue

Posted by struts-restful <fs...@ufi.com>.
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 <al...@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

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


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


Re: restful URL issue

Posted by Musachy Barroso <mu...@gmail.com>.
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 <al...@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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: restful URL issue

Posted by Alex Siman <al...@gmail.com>.
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org