Hi,
We’re developing a web application with Vaadin in an OSGi context.
I have a “main ui” bundle, that displays the Vaadin UI, and where I’ve a custom Theme that extends Runo. I can display images that are in the /img folder of the Theme, but I would like to get images from an other bundle.
The bundle that contains the image I want to display has a method “getIcon()”, called by the UI bundle, but whatever it returns, the image is not display.
Some issues :
- If I get the image with a ClassResource :
public Resource getIcon() {
return new ClassResource("icon/icon.png",application);
}
When the UI receive the ClassResource, The UI Class Loader search in UI bundle, so the “icon/icon.png” is not found.
-
I can’t use FileResource because my images are not on the disk but in bundles.
-
I can’t get image as an ExternalResource, but it doesn’t work (maybe I don’t use URL as I should ?). Here is the code I use to get the image URL in the Activator :
iconURL = pBundleContext.getBundle().getEntry("icon/icon.png");
I hope there is a solution to get images from other bundles in a Vaadin/OSGi application.
Thanks for your help !