l0rdn1kk0n/wicket-webjars — pull request #2 by benday280412 (2013-03-25 18:57:21+00:00)
Title: Making wicket-bootstrap OSGi compatible

Hi Michael,

This is the second part of the OSGi changes for wicket-boostrap.

Two items of note with this one:

Bundle URL Handling

The reflections API didn't have any ability to handle bundle URL's. This prevented any of the files from being found inside the bundle. I've created three new classes that are able to cope with bundles and then registered the URL type within the RecentVersionCallable class. Now when a URL is found starting with bundleresource:// we can handle it.

One downside is that I've had to include a new dependency for the OSGi stuff.

Accessing Webjars Content

Whilst the above lets us peer inside a bundle, we need to have the actual resources appear as through they exist within it. Hence the need for the fragment.

The pom simply downloads the webjars and then unpacks them into a fragment bundle. The fragment is then attached to some other bundle, which makes it appear as through it contains the attached files. In this case we must attach the fragment to the webjars-locator bundle, as the AssetLocator is used to provide the class loader, which in turn is used to find the resources (OSGi doesn't have a monolithic class path like traditional Java apps, it's per bundle.)

The container is just an example, but it's useful as a guide.

Let me know what you think and feel free to get in touch if anything is not clear.

Cheers,

Ben