我试图创建一个自定义策略,目的是提供服务掩码:
API的原始服务:
http://API/v1/profile
http://API/v1/account
带面具:
http://API/v1/user-profile
http://API/v1/user-account
并结合用户Bee的答案,此问题的解决方案:
<switch source="get-property('axis2', 'REST_URL_POSTFIX')">
<case regex="/v1/kyc-profile">
<property name="REST_URL_POSTFIX" value="/v1/profile" scope="axis2"/>
</case>
<case regex="/v1/kyc-account">
<property name="REST_URL_POSTFIX" value="/v1/account" scope="axis2"/>
</case>
</switch>
但是此解决方案仅在静态服务的情况下有效,但我还有其他服务,类似于:
http://API/v1/user-profile/{id-user}/details
http://API/v1/user-profile/{id-user}?expand=some_information
对于上一次服务,我有这个:
<switch source="get-property('axis2', 'REST_URL_POSTFIX')">
<case regex="v1/user-profile/[\/\w\W]*">
<property name="REST_URL_POSTFIX" value="/v2/cliente/{id-user}?expand=some_information" scope="axis2"/>
</case>
</switch>
[// w \ W] *这部分是{id-user}?expand = some_information及类似内容的正则表达式。
问题是:我需要放置动态值
,因为属性值(<property name="REST_URL_POSTFIX"
value =“ THIS” scope="axis2"/>
)包含此文本,例如:服务前的政策
http://API/v1/user-profile/1?expand=some_information
服务到政策
http://API/v1/user-profile/{id-user}?expand=some_information
我的问题是:
http://API/v1/user-profile/{id-user}?expand=some_information
]的服务设置动态值?http://API/v1/user-profile/{id-user}/details
我也有类似的情况,如何解决?我试图创建自定义策略,目的是提供服务掩码:API中的原始服务:http:// API / v1 / profile http:// API / v1 / account带有掩码:http:// API / v1 /用户个人资料http:// API / v1 / user -...
在您的调解顺序中,尝试按如下所示更改后端URL。