Presentación de contenido de archivo (pdf / tiff / png) en wicket 1.5

So I've run in to a problem that I can't seem to solve on my own.

I want to present a file in an iFrame. The file can either be pdf, png or tiff, and I don't know which on beforehand. The pdfs and tiffs should be presented with different actions (printing, saving to disk etc) - I rely on browser plug-ins for this.

What I do is this;

public ContentPanel(String id, final Atatchment attachment) {

    ResourceReference rr = new ResourceReference(attachment.getName()) {
        private static final long serialVersionUID = 1L;

        public IResource getResource() {
            return new ByteArrayResource(attachment.getMimeType(), attachment.getByteArray());

    WebMarkupContainer wmc = new WebMarkupContainer("myIframe");
    wmc.add(new AttributeModifier("src", (String) urlFor(rr, null)));


        <iframe wicket:id="myIframe" src=""></iframe>

This results in a 404 ("The requested resource is not availible"). The thing is, when I had some of the files cached they were presented the way I want them to be.

Gracias de antemano!

preguntado el 08 de noviembre de 11 a las 16:11

1 Respuestas

The problem was the the resource was not registered in the application. Just added:

    if (rr.canBeRegistered()) {

¡Y funciona!

respondido 09 nov., 11:12

Will do, as soon as it's possible. - bumaklion

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.