camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RichTaylor <>
Subject Re: from jetty to file
Date Sat, 29 Dec 2007 10:11:20 GMT

I'm trying to do this exact same thing as an exercise to learn Camel.  
Hopefully someone can chime in to help us out.  Here is what I've found....

I'm noticing that the Jetty endpoint expects an output message so the
message exchange used is "InOut".  This "InOut" exchange seems to make the
file component try to READ the specified file instead of WRITING to it.  I
found that if I created a text file (where I was expecting things to be
written to), it would be returned to the browser via the Jetty endpoint.  

So now I'm left wondering how one would pull messages from a Jetty endpoint,
write certain aspects of the message to a file (or another endpoint) AND
specify the output message for the Jetty endpoint to send back to the
client?  I'm wondering if this can't be done with the DSL and instead needs
a custom processor?      Cheers, Rich

Patrick Shea wrote:
> I'm trying to get a message from http (jetty) and save it to a file but it
> never works, the file is never created.
> Here's my routing code:
> public void configure()
> {
>     Processor proc = new Processor() {
>         public void process(Exchange e) throws Exception
> 	{
> 	 getLog().info("Headers: " + e.getIn().getHeaders());
>          System.out.println("Received exchange: " +
> e.getIn().getBody(String.class));
> 	}
>     };
> from("jetty:http://localhost:8080/hello").process(proc).setHeader(FileComponent.HEADER_FILE_NAME,
>         constant("message.txt")).to("file:target/hello?noop=true");
> }
> I'm expecting target/hello/message.txt but only target/hello is created.
> Also the file endpoint seems to be polling that folder like it is a
> consumer!
> Patrick

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message