AKB
AKB

Reputation: 5938

Mule Http Listner getting url parameter values

<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.

Upvotes: 2

Views: 3098

Answers (3)

Tareq Moh Qadommi
Tareq Moh Qadommi

Reputation: 261

try to use this line of code it works properly using MEL

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

also you can set this value inside a variable and handle it in any way you want

Upvotes: 1

deyvw
deyvw

Reputation: 820

When it comes to Java, to you read parameters like:

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

Hope it's usefull.

Upvotes: 0

AKB
AKB

Reputation: 5938

1) #[message.inboundProperties.'http.query.params'.referenceDate]

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

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

Upvotes: 4

Related Questions