问题
There is article from wso2 Map the Parameters of your Backend URLs with the API Publisher URLs.
Within it we have how the complete publisher URL looks like:
http://<hostname>:8280/<context>/<version>/<API resource>
And the whole use case is:
- You can define variables as part of the URI template of your API's resources. For example, in the URI template /business/{businessId}/address/, businessId is a variable.
- The variables in the resources are read during mediation runtime using property values with the "uri.var." prefix. For example, this HTTP endpoint gets the businessId that you specify in the resource http://localhost:8280/businesses/{uri.var.businessId}/details.
I would like to access during mediation also <version>
and <context>
part of the publisher URL. However, when I use expression uri.var.version
I will get the empty string. Or if I use the parameter value in <context>
then I will get also empty string value.
My sample:
<context>: /test/{service}
<version>: 1.0
<API resource>: /{operation}/{account}
http://localhost:8280/test/{service}/1.0/{operation}/{account}
I am able to map parameters from <API resource>
, it works like expected. But when I try to get uri.var.service
or uri.var.version
I will allways get empty string value.
Is it possible to somehow get values of parameters from <context>
and <version>
during mediation?
来源:https://stackoverflow.com/questions/48832995/wso2-api-manager-map-publisher-url-parameters-to-values