Creating Query Strings in Apache Camel Components

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.util.URISupport;

public final class SampleEndpoint extends DefaultEndpoint {
  private static final String PARAM_PARAM1 = "param1";
  private static final String PARAM_PARAM2 = "param2";

  public SampleEndpoint(final String param1, final String param2) {

    try {
      final Map<Object, Object> params = new HashMap<Object, Object>();

      params.put(PARAM_PARAM1, param1);
      params.put(PARAM_PARAM2, param2);

      final String uri = ... + "?" + URISupport.createQueryString(params);

    } catch (final URISyntaxException e) {
      LOG.error(e); // Nothing better to do



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s