You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by horyna <ph...@centrum.cz> on 2013/04/10 14:08:28 UTC

How return a file to user?

I am trying return a file like response for a http request. How to do it?
Everything i to is trying to save the file i need to load him :)

Some me (bad) idea was:
from("jetty:http://localhost:8085/someurl").enrich("file://somefile.txt",
agregator).?;



--
View this message in context: http://camel.465427.n5.nabble.com/How-return-a-file-to-user-tp5730656.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How return a file to user?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You mean that from the user its like downloading a file?
For that you would need to set the content-type to be file based
(google to figure out the mime type for that).
And you can just transform the message to a java.io.File and it will
be returned sa file content

Something a like:

from("jetty...")
.setHeader("Content-Type", constant("some mime type for file")
.transform().constant(new File("file://somefile.txt"));





On Wed, Apr 10, 2013 at 2:08 PM, horyna <ph...@centrum.cz> wrote:
> I am trying return a file like response for a http request. How to do it?
> Everything i to is trying to save the file i need to load him :)
>
> Some me (bad) idea was:
> from("jetty:http://localhost:8085/someurl").enrich("file://somefile.txt",
> agregator).?;
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-return-a-file-to-user-tp5730656.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen