argument method="from-string"

Poster Content
nk4um User
Posts: 101
July 28, 2010 17:57encoding does it
Yup, the encoding was the problem.  I was using the example from http://www.1060.org/forum/topic/642 which I guess is an incomplete translation of the <varargs/> element.

Thanks again
-J
nk4um Moderator
Posts: 485
July 28, 2010 14:33
Hi Jeff, I suspect you have a grammar mismatch. I.e. your request construction is assuming (because you are not issuing a request to endpoint) an endpoint with active URI escaping of arguments and you have a custom grammar that doesn''t have any escaping on the argument. What you need is an encoding="active" on the argument group to ensure it is decoded when the value is extracted from the identifier.

Our unit test for this scenario works. If you are still having problems show me the grammar and I''ll see if I can understand what''s happening.

Cheers, Tony
nk4um User
Posts: 101
July 28, 2010 00:01
oops .. the value of context.getThisRequest().getArgumentValue("arg") is "a%3Ab" -- the other value I got from a script that had just passed the value along.

So, when you have

request=context.createRequest(id);
request.addArgumentByValue("foo",aValue);
context.issueRequest(request);

and then in the subrequest you try to get the argument back out witt
value=context.getThisRequest().getArgumentValue("foo");

the value you get back isn''t the same one that you put in.
nk4um User
Posts: 101
July 27, 2010 23:56argument method="from-string"
I''m trying to use as-string arguments to change http query parameters into nkf arguments.  I have
<config>
  <grammar>res:/foo/bar</grammar>
  <request>
    <identifier>active:joe</identifier>
    <argumentname="arg" method="from-string">httpRequest:/param/arg</argument>
  </request>
</config>


Then in my implementation I use
context.getThisRequest().getArgumentValue("arg").  I expect it to be the same as context.source("httpRequest:/param/arg") and it is ... so long as there''s no special characters in it.  If the orginal request is "http://localhost:9000/foo/bar?arg=a:b" then context.source("httpRequest:/param/arg") is "a:b" but context.getThisRequest().getArgumentValue("arg") is "a%253Ab"

Any suggestions for how to handle this, or should I not use "from-string"?

Thanks
-J