Appending a file like that probably won't work. Here is what I am doing in a
route where I need to read a file:
.setBody().simple("path/To/File", File.class)
which also lets you use ${...} expressions to form the file path
If absolutely necessary you could then do a convertBodyTo but Camel should
handle conversion to an InputStream automatically.
Note that reading the body in a log message like that will mess up the process
for later steps because you will exhaust the InputStream and then there will be
nothing to read later so in real code if you want to log it you might have to
convert it to a string or byte array first.
On Sep 30, 2013, at 7:24 PM, alapaka <[email protected]> wrote:
> Seems like the only way (without using a processor/filter/endpoint ) is to
> use enrich.
> I tried to use a file directly in setBody:
>
> from("jetty:http://localhost:8123/services?matchOnUriPrefix=true")
> .log("Received Request\n----------------\n ${body}
> \n---------------------\n")
> .setBody(body().append(new File("C:\\devTestResponse.xml")))
> .log("Sending Response\n----------------\n ${body}
> \n---------------------\n")
> .end();
>
> this does not work. I infer from the documentation that setBody() is meant
> to work with expressions i.e. scripts/xpath etc.. that work on the current
> content of the Message.
>
> This exercise is more academic than a real requirement - just seeing what I
> can and cannot do within these routes. I can certainly live with pollEnrich
> as is.
> Thanks for all the help guys!
>
> aloha
> ala
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Jetty-consumer-how-to-send-reply-tp5740450p5740616.html
> Sent from the Camel - Users mailing list archive at Nabble.com.