You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by Clement Jebakumar <je...@gmail.com> on 2013/05/04 19:56:35 UTC

Loading Resources with Jetty in Karaf

Hi,

I have a bundle which supplies css/img folder. I tried with below code,
looks like jetty is not recognizing it. How to enable files in those
folders be served by Jetty

ServiceReference sRef = context.getServiceReference(HttpService.class
.getName());
HttpService service = (HttpService) context.getService(sRef);
service.registerResources("/", "/htmls", null);
// service.registerResources("/js", "js", null);
String webDir = getClass().getClassLoader().getResource("css")
.toExternalForm();
service.registerResources("/css", webDir, null);
service.registerResources("/img", "/img", null);

Files are put insider bundle. In eclipse devlopment, we have an unpack
option which solved the issue in Eclipse. But in karaf, i am not sure how
to make jetty to work with this.



*Clement Jebakumar,*
111/27 Keelamutharamman Kovil Street,
Tenkasi, 627 811
http://www.declum.com/clement.html