Mule表达式将变量的值与字符串#[';${forwardAddress}';进行比较。StartWith(';http://';)]
我需要在出站端点上动态设置地址,根据我在forward.url中接收到的内容,此出站url可以是HTTP或HTTPS。因此,我创建了两个子流,一个用于HTTP,另一个用于HTTPS 为了将请求路由到适当的子流,我编写了一个选择路由器,如下所示Mule表达式将变量的值与字符串#[';${forwardAddress}';进行比较。StartWith(';http://';)],mule,mule-studio,mule-el,Mule,Mule Studio,Mule El,我需要在出站端点上动态设置地址,根据我在forward.url中接收到的内容,此出站url可以是HTTP或HTTPS。因此,我创建了两个子流,一个用于HTTP,另一个用于HTTPS 为了将请求路由到适当的子流,我编写了一个选择路由器,如下所示 <set-variable value="#[message.inboundProperties['http.query.params']['forward.url']]" variableName="forwardAddress" doc:nam
<set-variable value="#[message.inboundProperties['http.query.params']['forward.url']]" variableName="forwardAddress" doc:name="Variable"/>
<logger message="Forward address is #[forwardAddress] , and does it start with http:// ~ #[String.valueOf('${forwardAddress}').startsWith('http://');]" level="INFO" doc:name="Logger"/>
<choice doc:name="Choice">
<when expression="#['${forwardAddress}'.startsWith('http://')]">
<flow-ref name="HttpCall" doc:name="HTTP subflow"/>
</when>
<when expression="#['${forwardAddress}'.startsWith('https://')]">
<flow-ref name="Httpscall" doc:name="HTTPS subflow"/>
</when>
<otherwise>
<set-payload value="The query string forward.url must start with http:// or https://" doc:name="Set Payload"/>
<http:response-builder doc:name="Invalid Request - 400" status="400"/>
</otherwise>
</choice>
但是,表达式工作不正常。我做错了什么?语法${}用于spring属性占位符。对流变量使用#[flowVars.forwardAddress]或#[forwardAddress]