How do I write out a file using camel, and return the name of the file?
If I send direct:report a byte[]. How do I 开发者_Go百科find out the absolute path and name of the file it was written to?
from("direct:report").to("file:target/reports");
The file producer will add an header with the key CamelFileNameProduced which contains the actual name of the file written.
The actual absolute filepath (path + name) for the output file that was written. This header is set by Camel and its purpose is providing end-users with the name of the file that was written.
Use the "fileName" attribute to set the name explicitly. The path is relative to your container (junit, servicemix, etc)...so the full path to your file would be [container-root]/target/reports/[fileName]
精彩评论