You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kuro <96...@gmail.com> on 2014/04/19 07:44:55 UTC

Patch - camel-jetty - Allow for static file handlers

Hi

I solved the issue of 
https://issues.apache.org/jira/browse/CAMEL-4363
http://camel.465427.n5.nabble.com/updload-server-multipart-td472630.html
http://code.notsoclever.cc/writing-camel-component-camel-static-resource/

Example:
from("jetty:http://localhost:{{port}}/myapp/myservice?"
	+ "resourceBase=htdocs"
	+ "&resourceWelcomeFiles=index.html,test.html"
	+ "&resourceDirectoriesListed=true"
	+ "&resourceEtags=true")
.setBody(constant("OK"));

Example resources:
/src/main/resources/htdocs/
index.html
sub/
   test.js

You can access the static files and camel-jetty endpoint.
http://localhost:{{port}}/myapp/myservice
http://localhost:{{port}}/index.html
http://localhost:{{port}}/sub/test.js
http://localhost:{{port}}/
(unsupported jsp files)

----
patchfile.txt
<http://camel.465427.n5.nabble.com/file/n5750368/patchfile.txt>  
----



--
View this message in context: http://camel.465427.n5.nabble.com/Patch-camel-jetty-Allow-for-static-file-handlers-tp5750368.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Patch - camel-jetty - Allow for static file handlers

Posted by Willem Jiang <wi...@gmail.com>.
Hi Kuro,

Thanks for sharing the solution with us.
But I’m afraid I cannot apply this patch into Apache Camel repository.

As I had said in CAMEL-4363, camel share the same servlet across the endpoints which share the same port, this option can only work per server(port) not per jetty endpoint.
If there are more than one jetty endpoints which share the same port are has the static resource setting, there is only one resource setting can work as expected. 

I think the good solution is using camel-static-resource component to handle this kind of request.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 19, 2014 at 1:45:25 PM, kuro (96259d@gmail.com) wrote:
> Hi
>  
> I solved the issue of
> https://issues.apache.org/jira/browse/CAMEL-4363
> http://camel.465427.n5.nabble.com/updload-server-multipart-td472630.html  
> http://code.notsoclever.cc/writing-camel-component-camel-static-resource/  
>  
> Example:
> from("jetty:http://localhost:{{port}}/myapp/myservice?"
> + "resourceBase=htdocs"
> + "&resourceWelcomeFiles=index.html,test.html"
> + "&resourceDirectoriesListed=true"
> + "&resourceEtags=true")
> .setBody(constant("OK"));
>  
> Example resources:
> /src/main/resources/htdocs/
> index.html
> sub/
> test.js
>  
> You can access the static files and camel-jetty endpoint.
> http://localhost:{{port}}/myapp/myservice
> http://localhost:{{port}}/index.html
> http://localhost:{{port}}/sub/test.js
> http://localhost:{{port}}/
> (unsupported jsp files)
>  
> ----
> patchfile.txt
>  
> ----
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Patch-camel-jetty-Allow-for-static-file-handlers-tp5750368.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.
>