Struts convention plugin/ action annotations
I am trying to override the restful URI using the action annotation as described in the convention plugin doc http://struts.apache.org/2.x/docs/convention-plugin.html#conventionplugin-apply...@actionand@Actionsattheclasslevel According to the docs I can use the following annotation on my method @Action("abc/test.xml") public String test() { } I have a namespace annotation for the action as such @Namespace("/struts/testing") When I type in the url http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello I get a unknown location error. I debugged the RestActionProxyFactory and it has the following values namespace = /struts/testing actionName = abc methodName = show What I am trying to achieve is that this url http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello will go to my action method test and will set the parameters id and test on the action before calling the method Can anyone advise on how to do this. I have also tried without using the namespace annotation and only a action annotation as such @Action("/struts/testing/abc/test.xml") In this case when debugging the RestActionProxyFactory after submitting the URL http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello I see the following values namespace = /struts/testing/abc actionName = test methodName = index Thanks -- View this message in context: http://www.nabble.com/Struts-convention-plugin--action-annotations-tp25613013p25613013.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
Re: Struts convention plugin/ action annotations
Hi thanks for the prompt reply. I have tried it with the following in my struts.xml file but that did not chnage anything I am still getting the same values. Which way do you recommend using the annotation with the namespace annotation or only the action annotation. Wes Wannemacher wrote: > > Make sure you have slashes in action names enabled - > > > > -Wes > > On Fri, Sep 25, 2009 at 10:22 AM, struts-restful wrote: >> >> I am trying to override the restful URI using the action annotation as >> described in the convention plugin doc >> >> http://struts.apache.org/2.x/docs/convention-plugin.html#conventionplugin-apply...@actionand@Actionsattheclasslevel >> >> According to the docs I can use the following annotation on my method >> >> @Action("abc/test.xml") >> public String test() { >> } >> >> I have a namespace annotation for the action as such >> >> @Namespace("/struts/testing") >> >> When I type in the url >> >> http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello >> >> I get a unknown location error. I debugged the RestActionProxyFactory and >> it >> has the following values >> >> namespace = /struts/testing >> actionName = abc >> methodName = show >> >> What I am trying to achieve is that this url >> http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello >> will go to my action method test and will set the parameters id and test >> on >> the action before calling the method >> >> Can anyone advise on how to do this. I have also tried without using the >> namespace annotation and only a action annotation as such >> >> @Action("/struts/testing/abc/test.xml") >> >> In this case when debugging the RestActionProxyFactory after submitting >> the >> URL >> http://localhost:8080/webContext/struts/testing/abc/test.xml?id=2&test=hello >> I see the following values >> >> namespace = /struts/testing/abc >> actionName = test >> methodName = index >> >> Thanks >> >> >> -- >> View this message in context: >> http://www.nabble.com/Struts-convention-plugin--action-annotations-tp25613013p25613013.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 >> >> > > > > -- > Wes Wannemacher > > Head Engineer, WanTii, Inc. > Need Training? Struts, Spring, Maven, Tomcat... > Ask me for a quote! > > - > 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/Struts-convention-plugin--action-annotations-tp25613013p25613239.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
Re: Struts convention plugin/ action annotations
Further to the above I changed my action annotation url to just show @Action("abc") above my method test. The result of this is that now it gets to my controller class but from the debug my default method has been set to show(). When the annotation is evaluated in the DefaultActionProxy class it resolves this annotation to match with my method test which is great. However the issue being that when I enter this class my default method has already been set to show in fact this is done in the RestActionProxyFactory class. If the default method had not been set then the code would use the method associated with the annotation as shown below private void resolveMethod() { // if the method is set to null, use the one from the configuration // if the one from the configuration is also null, use "execute" if (!TextUtils.stringSet(this.method)) { this.method = config.getMethodName(); if (!TextUtils.stringSet(this.method)) { this.method = "execute"; } } } So does anyone know how to override this method param being set by default. Maybe something to do with this struts.mapper.getMethodName - The method name to call for a GET request with an id parameter. Defaults to 'show'. but an mot sure All help appreciated -- View this message in context: http://www.nabble.com/Struts-convention-plugin--action-annotations-tp25613013p25613936.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
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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: restful URL issue
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 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 > 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-tp25641701p25664679.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
Re: restful URL issue
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 > > name="namedVariablePatternMatcher" > class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> > > > 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 >> 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
Re: restful URL issue
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 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 >>> >>> >> name="namedVariablePatternMatcher" >>> class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> >>> >>> >>> >> 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 >>>> 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 >>>>
Re: restful URL issue
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 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 >>>> >>>> >>> name="namedVariablePatternMatcher" >>>> >>>> class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> >>>> >>>> >>>> >>> 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 >>>>> >>>>> 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 servi
Re: restful URL issue
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 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 >>>> 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 >>>>>> >>>>>> >>>>> name="namedVariablePatternMatcher" >>>>>> >>>>>> class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> >>>>>> >>>>>> >>>>>> >>>>> 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 th
Re: restful URL issue
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 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 >>>>> 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 >>>>>>> >>>>>>> >>>>>> name="namedVariablePatternMatcher" >>>>>>> >>>>>>> class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/> >>>>
Re: restful URL issue
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 >>> 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 >>>>>> 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 >>>>>>> >>>>>>> >>>>>>> >
Re: restful URL issue
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 >>>> 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 >>>>>>> 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 >>>>>>>> ha
Parameters Interceptor
I am using the struts-restful default interceptor stack which uses the static params interceptor and the paramters interceptor. The result of using both interceptors is that it is calling setId twice. However if I remove the static params interceptor it does not call setId at all and if I remove the params Interceptor then no variables on the action are being set Is there a way to do both things and call the set id method twice? -- View this message in context: http://www.nabble.com/Parameters-Interceptor-tp25921673p25921673.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
Testing Struts Restful Web Services
Does anyone know of any tool that can be used to test the restful web services? In my application the controllers are called from a third party application so there are no Jsp's. If i had jsp's i would use maybe JwebUnit to test the app. Are there any alternatives? Thanks -- View this message in context: http://www.nabble.com/Testing-Struts-Restful-Web-Services-tp26008963p26008963.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