Url rewriting 复杂路由WSO2 API资源uri模板

Url rewriting 复杂路由WSO2 API资源uri模板,url-rewriting,wso2,url-routing,wso2esb,uritemplate,Url Rewriting,Wso2,Url Routing,Wso2esb,Uritemplate,简短版本。 我正在尝试创建一个API来处理 /goals/risks /goals/types /goals/{goalID} 到目前为止,这是我所拥有的,但它不是我想要的。因为它给了我/goals/goal/{goalId} <api xmlns="http://ws.apache.org/ns/synapse" name="GoalAPI" context="/goals"> <resource methods="GET" uri-template="/risks"

简短版本。 我正在尝试创建一个API来处理

/goals/risks
/goals/types
/goals/{goalID}
到目前为止,这是我所拥有的,但它不是我想要的。因为它给了我/goals/goal/{goalId}

<api xmlns="http://ws.apache.org/ns/synapse" name="GoalAPI" context="/goals">
  <resource methods="GET" uri-template="/risks" faultSequence="ReturnError">...</resource>
  <resource methods="GET" uri-template="/types" faultSequence="ReturnError">...</resource>
  <resource methods="GET" uri-template="/goal/{goalId}" faultSequence="ReturnError">...</resource>
</api>

...
...
...
GoalID将始终匹配
/^\d+$/
,因此,如果我能以某种方式通过它进行路由,它将工作。最后,我还想添加
/goals/{goalID}/item和/goals/{goalID}/items/{itemID}
,但我相信,一旦我找到了第一步,这将非常容易


如果这里没有办法做到这一点,是否有办法在wso2到达资源之前重写它内部的url,然后替换
/goals/(\d+.*)
使用
/goals/goal/$1?
我知道我可以通过代理路由它,然后在apache或其他软件中重写它,但这似乎违背了WSO2的目的。

因此,在进一步研究后,没有得到任何回应,我只是盯着代码看,就可以想出

 <api xmlns="http://ws.apache.org/ns/synapse" name="GoalAPI" context="/goals">
   <resource methods="GET" uri-template="/{goalID}" faultSequence="ReturnError">
      <inSequence>
        <switch source="get-property('uri.var.goalId')">
          <case regex="risks">...</case>
          <case regex="types">...</case>
          <default>...Handle the ID here...</default>
        </switch>
      </inSequence>
      ...
   </resource>
 </api>

...
...
…在这里处理ID。。。
...