Mule Http Listner getting url parameter values

时间:2015-10-30 23:17:34

标签: mule

<flow..>
    <http:listener-config name="HTTP_Listener_Configuration" host="${http.hostname}" port="${http.port}" basePath="${http.base.path}" doc:name="HTTP Listener Configuration"/>
    <http:listener config-ref="HTTP_Listener_Configuration" path="store/*" doc:name="HTTP"/>
    Old http end point
    <!--  <http:inbound-endpoint address="http://${http.hostname}:${http.port}/${http.base.path}/store" doc:name="HTTP" exchange-pattern="request-response">
        <object-to-string-transformer />
    </http:inbound-endpoint> -->
    <apikit:router config-ref="store-api-config" doc:name="APIkit Router" />  
</flow>  
<flow name="get:/rates/search:smartstore-api-config">
     <logger message=" #[message.inboundProperties['referenceDate']]" level="INFO" doc:name="Log Request"/>
</flow>

When I try to invoke the url, I am getting null value in logger. If I enable old http end point point it is working fine.

http://localhost:8899/apis/myapp/myrates/search?referenceDate=2015-01-01

I have tried with this link, but didnot work.

3 个答案:

答案 0 :(得分:4)

1) #[message.inboundProperties.'http.query.params'.referenceDate] 2) #[message.inboundProperties.'http.query.params'.get('referenceDate')] 3) #[message.inboundProperties.get('http.query.params').get('referenceDate')]

答案 1 :(得分:1)

尝试使用这行代码使用MEL

正常工作
#[message.inboundProperties.get('http.query.params').get('referenceDate')] 

您也可以在变量中设置此值并以任何您想要的方式处理它

答案 2 :(得分:0)

说到Java,你可以阅读如下参数:

eventContext.getMessage().<Map<String,Object>>getInboundProperty("http.query.params").get("yourParam");

希望它有用。