Say, I have an image 'logo.png' in the same package as class 'StaticScope' and I mount this image
as a shared resource at path 'static/images/logo.png'.
How should I access this resource in other components?

For example:

In MyApplication.init():
  ...
ResourceReference ref = new ResourceReference(StaticScope.class, "logo.png"); mountSharedResource("static/images/logo.png", ref.getSharedResourceKey());
  ...

Fine, now my image is accessible at the mounted path 'http://..../ static/images/logo.png'.

But if I try to access this resource in Java using SharedResource.get(...), for example to use it in a Link, I always end up with the wrong URL ( something like ?wicket:interface=: 0:header:logolink:image::IResourceListener::)

Here's my code:

public class Header extends Panel {

      public Header(final String id) {
                super(id);
                add(new SimpleAttributeModifier("id", "header"));
BookmarkablePageLink<Void> logoLink = new BookmarkablePageLink<Void>("logolink", HOMEPAGE_CLASS);
                // XXX
Resource resource = KuppelboxApplication .getInstance().getSharedResources().get(StaticScope.class, "logo.png", null, null, true);

                logoLink.add(new Image("image", resource));
                add(logoLink);
                add(new UserPanel("user-panel", Index.class));
        }
}

Or should I use "new Image("image", new ResourceReference(StaticScope.class, "logo.png"))?
(but then I wonder why SharedResources returns Resource only)
Or should I use wicket:link? Or static HTML code only?


Regards,

Robin.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to