Hello,

I have been a naughty boy; I designed my form without using a
LoadableDetachableModel. Serves me right. I have now changed my page's
domain object so that it is used in the form and the form's WebPage using a
LoadableDetachableModel.

So far so good, but I have a problem with my Image component. I used to use
my page's domain object to populate my image component's model like this:

    ByteArrayResource resImage = null;
    if ((g_pidData.sUploadFileContentType != null)
     && (g_pidData.baUploadFileData != null))
      resImage = new ByteArrayResource(g_pidData.sUploadFileContentType,
       g_pidData.baUploadFileData);

    Image g_imgImage = new Image("imgImage", resImage);
    frmForm.add(g_imgImage);

Basically, I used the return value of

  ByteArrayResource(String sUploadFileContentType, byte[] baUploadFileData);

as the model of my Image component, with g_pidData as my domain object.

Now I have replaced my domain object with a LoadableDetachableModel. This
model's load() method returns a ByteArrayResource instance, created by using
the data members of a g_pidData instance which is local to the page's
constructor. I copy the byte array using Arrays.copyOf(...) before
constructing my ByteArrayResource instance.

I now get the following exception once my page has shown:

  08-Mar-2011 21:24:15 org.apache.wicket.RequestCycle logRuntimeException
  SEVERE: Unable to write the response
  org.apache.wicket.WicketRuntimeException: Unable to write the response
        at org.apache.wicket.Response.handleException(Response.java:286)
        at org.apache.wicket.Response.write(Response.java:310)
        ...
  Caused by: java.io.IOException: Closed
        at
org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:629)
        at
org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:579)
        at org.apache.wicket.util.io.Streams.copy(Streams.java:159)
        at org.apache.wicket.util.io.Streams.copy(Streams.java:126)
        at org.apache.wicket.Response.write(Response.java:306)
        ... 32 more


Am I using the correct resource for my image component, or should I use a
better one?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choice-of-Resource-for-my-Image-component-tp3342289p3342289.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to