Setting multiple headers in camel route -


is possible set multiple exchange headers in camel route using single call setheader.

something this

<from uri="file://inputdir/?delete=true" /> <!-- need set multiple headers @ once(as comma separated list)-->     <setheader headername="headername">         <constant>headerval</constant>     </setheader> <to uri="mock:end"/> 

or should create custom processor this?

no cant set multiple headers @ once far aware. in case custom processor more effective.

you might want @ simple expression language here here can ognl notation in camel route xml file. ognl allow specify chain of methods in expression.

for example suppose have message contains employee object has getsalarygrade() method set header value using following syntax:

<setheader headername="salarygrade">     <simple>${body.getsalarygrade()}</simple> </setheader> 

you example create simple class returns list , store list in header , access list via simple in route. following code untested should give idea.

public class listcity {      public list<string> listcities()     {         arraylist< string> list = new arraylist<string>();         list.add("new york");         list.add("johannesburg");            list.add("hochiminh");         return list;     }  } 

declare list city bean in xml. can set list header using this:

<setheader headername="citylist">     <simple>${listcity.listcities()}</simple> </setheader> 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -