You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Cristiano Costantini <cr...@gmail.com> on 2013/08/01 13:22:57 UTC

Expose files in a directory over HTTP

Hi all,

Does it exist an easy way with Camel to publish a folder of static files to
HTTP?

I expect that it should be possible to write a route like:

<from uri="jetty:....">
<to uri="file:....">

with the proper options so that the input request to jetty is used to read
a file, and return it as http response via the inOut exchange.

Is this possible?
Any idea on which parameters to use for the two components?

Thanks,

Cristiano

Re: Expose files in a directory over HTTP

Posted by Cristiano Costantini <cr...@gmail.com>.
Hi,
the way I need to do it with camel is that I do need to specify both the
URL of the external folder from and the real file system path within a
spring beans.xml file. With camel in spring, I would be able to do it.

Do you think I can do that from spring xml?

Do you have any example of code to use?

Thank you!
Cristiano



2013/8/1 Willem jiang <wi...@gmail.com>

> If you just watt expose the static files though jetty, you can set the
> org.eclipse.jetty.server.handler.ResourceHandler into the jetty consumer
> with option of handlers.
>
> You don't need to do it on the camel route.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Thursday, August 1, 2013 at 7:22 PM, Cristiano Costantini wrote:
>
> > Hi all,
> >
> > Does it exist an easy way with Camel to publish a folder of static files
> to
> > HTTP?
> >
> > I expect that it should be possible to write a route like:
> >
> > <from uri="jetty:....">
> > <to uri="file:....">
> >
> > with the proper options so that the input request to jetty is used to
> read
> > a file, and return it as http response via the inOut exchange.
> >
> > Is this possible?
> > Any idea on which parameters to use for the two components?
> >
> > Thanks,
> >
> > Cristiano
>
>
>

Re: Expose files in a directory over HTTP

Posted by Willem jiang <wi...@gmail.com>.
If you just watt expose the static files though jetty, you can set the  
org.eclipse.jetty.server.handler.ResourceHandler into the jetty consumer with option of handlers.

You don't need to do it on the camel route.  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, August 1, 2013 at 7:22 PM, Cristiano Costantini wrote:

> Hi all,
>  
> Does it exist an easy way with Camel to publish a folder of static files to
> HTTP?
>  
> I expect that it should be possible to write a route like:
>  
> <from uri="jetty:....">
> <to uri="file:....">
>  
> with the proper options so that the input request to jetty is used to read
> a file, and return it as http response via the inOut exchange.
>  
> Is this possible?
> Any idea on which parameters to use for the two components?
>  
> Thanks,
>  
> Cristiano