>>>>> "Chaz Kettleson via dev" <[email protected]>:

> 2. The fact that if you create your own context, you need to pass the
> bundle to the constructor of ServletContextHelper in order for it to
> resolve resources correctly (this drove me completely nuts)
[...]

> @Component(
>     service = ServletContextHelper.class,
>     property = {"osgi.http.whiteboard.welcome.file=index.html"})
> @HttpWhiteboardContext(name = "dashboard", path = "/dashboard")
> @HttpWhiteboardContextSelect("(" + HTTP_WHITEBOARD_CONTEXT_NAME + 
> "=dashboard)")
> @HttpWhiteboardResource(pattern = "/*", prefix = "/static")
> public class DashboardServletContextHelper extends ServletContextHelper {

>   @Activate
>   public DashboardServletContextHelper(final BundleContext bundleContext) {
>     super(bundleContext.getBundle());
>   }
> }

Hm... my context helpers have far less annotations and no injection of
bundlecontext and they seem to work...?
 
https://github.com/steinarb/sampleapp/blob/master/sampleapp.web.security/src/main/java/no/priv/bang/sampleapp/web/security/SampleappServletContextHelper.java

Reply via email to