Patch - camel-jetty - Allow for static file handlers

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Patch - camel-jetty - Allow for static file handlers

kuro
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
----
Reply | Threaded
Open this post in threaded view
|

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

Willem.Jiang
Administrator
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 ([hidden email]) 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.
>