Okay I solved this - if someone would be interested this is what I have done:
<route>
<from uri="seda://..."/>
<to uri="bean:..."/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-Type">
<constant>application/x-www-form-urlencoded</constant>
</setHeader>
<to uri="http://..."/>
</route>
Inside of my bean I've done the processing and then set the body like this:
Map<String,String> map = new HashMap<String,String>() {
public String toString() {
StringBuilder sb = new StringBuilder();
Iterator<Map.Entry<String,String>> it =
this.entrySet().iterator();
Map.Entry<String,String> entry;
String value;
while(it.hasNext()) {
entry = it.next();
try {
value =
URLEncoder.encode(entry.getValue(), "UTF-8");
sb.append(entry.getKey() + "=" + value);
if (it.hasNext()) {
sb.append("&");
}
} catch (Exception e) {
// exceptions consuming is bad!
}
}
return sb.toString();
}
};
map.put("name1", "value1");
map.put("name2", "value2");
exchange.getOut().setBody(map, String.class);
I guess there will be some easier and nicer way how to do this!
Cheers.
--
View this message in context:
http://camel.465427.n5.nabble.com/HTTP-Post-component-parameters-tp4937377p4938804.html
Sent from the Camel - Users mailing list archive at Nabble.com.