You have made an array of strings in the above code fileName[i]? If so you can write a loop which retrieves each string from the above array and append to a string. And on each interation, concatenate a comma Something like
while((strLine=br.readLine())!=null) { if(strLine.contains(".lis")) { fileName[i]=strLine.substring(strLine.lastIndexOf('/')+1); i++; } } String nameList = ""; for (i=0;i<fileName.length;i++) { nameList=nameList+fileName[i]+","; } exchange.getIn().setHeader("FileNamesWithoutExtension",nameList); On Wed, Jan 15, 2014 at 6:02 PM, nirosha27 <nirosha.makk...@wipro.com>wrote: > Hi, > > I am reading a file line by line...this program will check for filenames > which have .lis extension....I am retrieving the filenames...after getting > the filenames I have to setHeader with comma separeted values of all the > filenames.... How to do it? > > while((strLine=br.readLine())!=null) > { > if(strLine.contains(".lis")) > { > > fileName[i]=strLine.substring(strLine.lastIndexOf('/')+1); > > > exchange.getIn().setHeader("FileNamesWithoutExtension",fileName[i]); > > i++; > } > > } > > Thanks > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/SetHeader-with-same-header-name-having-multiple-values-tp5745993.html > Sent from the Camel - Users mailing list archive at Nabble.com. >