Sri Arun
Sri Arun

Reputation: 143

Http query parameters needs to be extract in Java for Mule Application?

I am new to Mule. My question is how to extract HTTP parameters inside a java component. I tried this in Java class of Mule application. The query param name is id But it's not actually working So far I tried the following: ---

MuleMessage message = eventContext.getMessage();
String id = message.getInboundProperty("id");

I am getting null value. How to extract that in Java class. An example will be great

Upvotes: 0

Views: 408

Answers (1)

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8321

This is very easy. You can use following in your Java:

MuleMessage muleMessage = eventContext.getMessage();
Map<String, String> queryParams = muleMessage.getInboundProperty("http.query.params");
String id=queryParams.get("id");
System.out.println(id);
return muleMessage;

Upvotes: 4

Related Questions