ubuntux
ubuntux

Reputation: 404

Mule ESB Server 3.6.1 - HTTP Component URI Params via GET method to Java Component

I am new to Mule ESB... Using Anypoint Studio, how will I be able to access a HTTP GET params in a Java Component? An example would be great!

Upvotes: 0

Views: 293

Answers (1)

clare
clare

Reputation: 526

You can access inbound properties as follows:

import java.util.Map;

import org.mule.api.MuleEventContext;
import org.mule.api.MuleMessage;
import org.mule.api.lifecycle.Callable;

public class MyComponent implements Callable{

@Override
public Object onCall(MuleEventContext eventContext) throws Exception {
    MuleMessage message = eventContext.getMessage();

    Map uriParams = message.getInboundProperty("http.uri.params");
    String name = (String) uriParams.get("name");

    ...
}

}

Where 'name' is the name of the URI param you want to access. If you want to access other inbound properties, replace 'http.uri.params' with the inbound property you want to access. HTH

Upvotes: 2

Related Questions