Mule:如何在http请求端点上动态设置URL [英] Mule: How to dynamically set a url on an http request endpoint
本文介绍了Mule:如何在http请求端点上动态设置URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用已弃用的http实现,可以从有效负载或属性中动态设置出站http端点上的URL:
Using the deprecated http implementation it was possible to dynamically set the url on an outbound http endpoint from the payload or properties:
<http:outbound-endpoint address="http://#[payload]" method="GET" />
是否可以使用新的http请求连接器执行此操作?
Is it possible to do this using the new http request connector?
推荐答案
是的,是的。这是一个简单的例子:
Yes, it is. Here is a simple example:
<http:request-config
name="HTTP_Request_Configuration"
host="#[flowVars.address]"
port="80"
basePath="/"
doc:name="HTTP Request Configuration"/>
<flow name="httpFlow">
...
<set-variable
variableName="address"
value="#[message.inboundProperties.'http.query.params'.site]"
doc:name="Set site address variable"/>
<http:request
config-ref="HTTP_Request_Configuration"
path="/"
method="GET"
doc:name="Get dynamic HTTP"/>
</flow>
只需使用您需要的MEL表达式定义主机属性。
Just define the host attribute using the MEL expression you require.
host =#[flowVars.someVariable]
host="#[flowVars.someVariable]"
这篇关于Mule:如何在http请求端点上动态设置URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文