
Originally Posted by
dsklyut
Hi,
I am trying out slices and trying to find best way to attach static content to the host bundle. I would like to provide theme support and experimenting right now with different approaches. Fragments seem to be out of the question.
We were actually talking about exactly this sort of thing in the office yesterday: we were discussing ways of making the styling of a Web bundle pluggable. The two candidates were to use a fragment that attaches to the Web bundle, and to make the Web bundle a Slice Host and use a Slice to provide the styling. We didn't get much beyond this in the discussion so we don't have any definitive recommendations to make at this stage.
A key thing to note is that in the fragment bundle approach, the fragment will only add things to the classpath of the Web bundle, it won't add entries to the area on the filesystem that Tomcat can see, and from which it can directly serve static content. This means that you'd have to use some form of ResourceServlet that used the Web application's classloader to locate and server static resources. Using a Slice would not have this restriction and is probably a more elegant approach.
Can fragments be attached to shared services web bundles?
Yes, they can.
What is the final symbolic name of the deployed web bundle? Is it even treated as a bundle?
Yes, they are treated as bundles.
If no Bundle-SymbolicName is specified, then one is generated. The generated BSN is simply the name of the war file that you installed, e.g. if you install foo.war the bundle that's generated from the war will have a Bundle-SymbolicName: foo.war header.
Rather than relying on this generation, you can update the MANIFEST.MF in your WAR file to specifying a Bundle-SymbolicName. The installation of the WAR will only generated a Bundle-SymbolicName if one is not already present in the manifest.
Looking at osgi console I did not see a deployed war file. (this is most likely an RTFM issue on my part, but still please help )
The bundle that's generated from the WAR should definitely be visible in the console. Hopefully now that you know what the bundle's BSN will be, it'll be a little easier to spot it.
Andy Wilkinson
SpringSource