Inside an OSGi standard module (jar, not a wab), I am exposing both a few web services (with the OSGi JAX-RS whiteboard) and an index.html static file using @HttpWhiteboardResource
(which itself works with the OSGi HTTP whiteboard).
Everything works quite well except one stupid thing: I cannot serve my index.html file from the root. (I want to do http://domain, not http://domain/index.html).
Usually the solution to this would be to declare a "welcome page". Alas, the OSGi spec for the HTTP whiteboard does not seem to allow this. An other (desperate) solution would be to bind root with @HttpWhiteboardResource.pattern
, but it does not work (seems logical, the root is owned by the whiteboard).
It seems pax web
has a workaround for this with a non-standard extension. However, I'm using Apache Felix http and I cannot find a single reference to welcome pages in their code or documentation. And I would prefer not to change it, since it is would require a lot of testing in a very complex solution.
So would anyone know of a way to solve my issue with either standard OSGi stuff or Felix specific stuff? Thanks!
Indeed, welcome files (and jsps, SCIs, login configs, ...) are not covered by OSGi specifications (HttpService, Whiteboard and WAB specs from OSGi CMPN).
That's why Pax Web was created in the first place. Recently, Pax Web 8 was released with lots of specification and stabilization improvements, so I recommend you to give it a try. See for example WhiteboardWelcomeFilesTest.java.