[英]WSO2 API properties in custom handler
如何在 WSO2 自定义处理程序中访问 API 相关信息,例如 API 属性(在发布者中定义)?
请参考以下代码。 它将打印所有messagecontext属性键集及其值。
Set propertySet = context.getPropertyKeySet();
for (Object propertyKey : propertySet) {
log.info("Key: " + propertyKey.toString() + "| value: "
+ context.getProperty(propertyKey.toString()));
}
另请参阅此
正如我所见,处理程序/调解器可以通过本地注册表访问 api 属性
在 xml 配置中定义时可以是这样的
<sequence name="custom-sequence" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom">
<property
name="prop"
expression="get-property('registry',
fn:concat(
'gov:/apimgt/applicationdata/provider/',
$ctx:api.ut.apiPublisher, '/',
$ctx:api.ut.api, '/',
$ctx:api.ut.version, '/',
'api@api_meta.my_property'
))" />
</log>
</sequence>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.