Hi,
I think the problem is that the location where the file is stored,
differs from the URL you use in the body.html snippet. The reason for
this is that the location name you specify in the resource is prefixed
by the system with the given runtime bundle id, which you can't know by
creation time of the body.html. Sorry, I didn't think about that.
You can check this by looking up your image somewhere under the context
root of the rap application:
<path to eclipse
installation>\workspace\.metadata\.plugins\org.eclipse.rap.ui\context
(Note that this is the default under MS Windows without changing the
launch-config settings for the workspace)
But you can use a different approach to register the image without
bundle prefix:
- create an Activator for your bundle (skip this if you already have
one...)
- register the image in the activator's start method like this:
ClassLoader loader = Activator.class.getClassLoader();
IResourceManager manager = ResourceManager.getInstance();
ClassLoader bufferedLoader = manager.getContextLoader();
manager.setContextLoader( loader );
try {
String path = "path/to/image.jpg";
manager.register( path, loader, getResourceAsStream( path );
} finally {
manager.setContextLoader( bufferedLoader );
}
Note that for this solution the image has to be available at the given
path in the bundles classpath.
Hope that helps.
Ciao
Frank