0

I have a REST extension and I have beeing accessing the parameters that have been passed, both in GET and POST as follows.. The parameters are passed as form-data or x-www-form-urlencoded. In my REST extension I would access the parameters via xdmp:get-request-field("remoteURL").

In ML-8, this worked where in when calling the WS I would pass in the parameters as remoteURL and it worked..

Now in ML-9.0-3, it does not work, so I tried passing the parameters via rs:remoteURL and access in the REST extension as xdmp:get-request-field("remoteURL") and it fails, but when I access as xdmp:get-request-field("rs:remoteURL"). it works.. Did this got changed in ML-9.0-3 ?

Just for complete I am including my REST extension code as well

declare function repoTest:post($context as map:map, $params  as map:map,$input   as document-node()*) as document-node()*
{
  let $_ := xdmp:log("Inside the Repo Test POST")
  let $remoteURL :=xdmp:get-request-field("remoteURL")
  let $_ := xdmp:log($remoteURL)
  let $output := json:object()
  let $_ :=  map:put($output, "remoteURL", $remoteURL)
  return document { xdmp:to-json($output) }
};
Ravi
  • 1,179
  • 6
  • 13

2 Answers2

1

The documented approach has always been to use the rs: prefix for user-defined parameters.

If parameters without the prefix were provided to the extension, that was unexpected.

Hoping that clarifies,

ehennum
  • 7,295
  • 13
  • 9
0

I am not aware of a change in this, though it could be very well possible. I'd recommend accessing parameters via the $params map:map, which is the recommended way for REST extensions anyhow. $params will always contains any rs: request parameters without the rs: prefix.

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35
  • Can I use map params to get the binary content and filename etc – Ravi Nov 14 '17 at 20:04
  • I never tried to be honest. I suspect currently not. At least not with form-data. I think it should be able to handle multipart/mixed though. – grtjn Nov 15 '17 at 19:49