Hello Grzegorz, The WAB approach works - even with the HTML files located under the bundle's root directory.
For the whiteboard approach: I only have one resource service class in my "main" help bundle, i.e., the host bundle, no additional services in the fragment bundles. Of course, using the same resource pattern multiple times would create a conflict. My assumption was, since the resource service can serve the HTML files from the host bundle, it will also use the files from the fragment bundles, because they share the same class loader. Obviously, this assumption was wrong. So, I searched for an example where somebody has solved that, e.g., by searching for resources in all attached fragment bundles and make them available to the resource servlet. Possibly in the activate method of the resource service. In a similar way as the pax-web-extender-war does it, but of course much simpler, because there is no need to look for Web applications, only few folders with resource files. If such example doesn't exist, I either must try myself, or just accept a bit of "overweight" and continue using WAB. Regards Jochen Am 11. Januar 2023 12:28:35 MEZ schrieb Grzegorz Grzybek <[email protected]>: >Hello > >With Pax Web 8, fragment bundles attached to WAB are searched for >"META-INF/resources/" resource - each such resource is added to WAB >resource path. See for example >https://github.com/ops4j/org.ops4j.pax.web/tree/web-8.0.15/samples/samples-war/war-required/src/main/resources/META-INF > >samples/samples-war/war-required and samples/samples-war/war-requiring are >_wired_ using Require-Bundle relationship, but normal fragment should also >work. > >Mind that "META-INF/resources" is the recommended approach, specified in >Servlet API specification and handled fully in Pax Web 8+. > >Whiteboard is not an implementation of Web Application specification and >while bundles can register Whiteboard services into the same target web >context, it's not possible that two bundles register resources for the same >mapping to create kind of _overlay_. > >regards >Grzegorz Grzybek > >śr., 11 sty 2023 o 11:03 Jochen Walz <[email protected]> >napisał(a): > >> Hi, >> >> With Karaf 4.3.6 / Pax Web 7.3.23, I had used a WAB to provide some HTML >> files for online help, and - depending on the parts of my application which >> are installed - fragment bundles with additional help files. The war >> feature handled that correctly. >> >> With Karaf 4.4.2, I wanted to switch to using the pax-web-http-whiteboard, >> providing a resource service in my main help bundle with appropriate >> settings for HTTP_WHITEBOARD_RESOURCE_PATTERN and >> HTTP_WHITEBOARD_RESOURCE_PREFIX. Looks bit more lightweight than a WAB. >> >> The HTML files from my main help bundle are served correctly, but not the >> ones from the fragment bundles. >> >> So: does somebody know an (easy) way to make resources in fragment bundles >> visible for the resource service, assumed that all fragments are already >> installed when the bundle with the resource service is started? Possibly >> some example exists somewhere. Or would that lead so far that it is by far >> easier to just keep the WAB approach with the pax-web-war feature? >> >> Thanks & Regards, >> Jochen >>
