2

The documentation says:

Path computed from masking the listenerPath and taking the difference. Note that this is only calculated when the null otherwise.

It seems this sentence is not complete so I am unsure of the expected value of maskedRequestPath. If my request is http://localhost:8081/hello/world?abc=def and my HTTP Listener configuration is:

<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="dc9" >
    <http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>

what should be the expected output of this transform message?

%dw 2.0
output application/json
---
{
    "maskedRequestPath": attributes.maskedRequestPath
}

I would like to know if it is "" (null) or "/".

Pierre
  • 51
  • 8

1 Answers1

2

It depends on the request path that you configure at the http:listener level (i.e. at the flow source) and the base path at the http:listener-config level.

The full sentence of that documentation (as visible from the source code)

Path computed from masking the {@code rawRequestPath} with the {@code listenerPath} and taking the difference. Note that this is only calculated when the {@code listenerPath} is open (ends with a wildcard) and will be {@code null} otherwise.

So, for your request http://localhost:8081/hello/world?abc=def the answer depends on the path you configured at your http:listener (considering that you have not put anything as basepath in http:listener-config)

  1. If it is /hello/* then your maskedRequestPath will be /world
  2. If it is /hello/world/* then your maskedRequestPath will be /
  3. If it is just /hello/world then it will be null as it does not end with a wildcard.
Harshank Bansal
  • 2,798
  • 2
  • 7
  • 22
  • Thank you Harshank, I forgot to add my listener path, it was indeed one of the options you pointed out: /hello/world/*. So the expected behavior is it should return '/' and that's what I'm seeing. Thank you! – Pierre Mar 22 '23 at 22:35