I have seen examples containing things like this:
mountSharedResource("/images/logo.gif", new ResourceReference(ImageScope.class,
"logo.gif").getSharedResourceKey());
mountSharedResource("/resource",
Application.class.getName() + "/" + resourceKey);
But the Javadoc says this for the constructor:
ResourceReference(java.lang.Class<?> scope, java.lang.String name);
So when you create a ResourceReference
, you give it a class. Why? Usually you would want either global scope or the scope of the ResourceReference
object you have just created, no?
Also, what is name
? Is it the sharedResourceKey
? If not, where does the resourceKey
come from? How is it generated, and why isn't it the name? Or is name
looked up on the classpath, and magically loaded (assuming that there is only one file with that name on the classpath; what happens if there are multiple?)? If it does load a file with that name, why doesn't it say so in the Javadoc?
How do you actually assign a physcial resource to this ResourceReference
? There is a getResource()
, but they seem to have missed out setResource()
. If you have, say, an image file in your webapp
dir, how do you "attach" the reference to the file, its path, or even a byte stream of the file's contents? If there were a way to read resources in the webapp, this might be useful, but you can't; it's only in the classpath.
I would love to be able to "mount" the contents of, say, webapp/games/someGame.swf
so that the SWF in a webapp can be accessed by the Wicket pages, or just get some kind of handle on them.