Search code examples
wso2wso2-api-managerapache-synapse

Obtain WSO2 API Manager synapse resource uri-template from MessageContext


Is there any way to get resource uri-template value from MessageContext to be used in custom Handler?

For example, if the api synapse config is

...
<api xmlns="http://ws.apache.org/ns/synapse"
         name="something"
         context="something"
         version="something"
         version-type="context">
       <resource methods="GET" uri-template="/?test={test2}" faultSequence="fault">
...

how can i get the '/?test={test2}' string into my custom handler.


Solution

  • you could use following inside your handler

    String resourceString = (String) synCtx.getProperty("API_ELECTED_RESOURCE");
    

    where synCtx is the MessageContext