Re: Choice of Resource for my Image component

2011-03-29 Thread Ian Marshall
3.  All I need to do now is find out why my use of a NonCachingImage
together with my descended LoadableDetachableModel in the form of my web
page still results in huge session size (1MB), which is forbidden in Google
App Engine.

I have fixed my problem of a WebPage's NonCachingImage holding onto an
image's data and thus causing a user's session size to get very large
indeed. The model passed to the NonCachingImage was descended from
LoadableDetachableModel.

Instead, I now descend my model from LoadableDetachableModel.
ItemImageResource is a class I descend from DynamicImageResource by
implementing its abstract method

  protected byte[] getImageData().

This method:
  ·  constructs a ByteArrayResource instance
  ·  using this instance to yield a IResourceStream
  ·  uses the resource stream to yield an InputStream
  ·  reads from this input stream into the byte array, which is returned by
the method.

This shrinks the session size to much closer to where I want it, with no
image data being included in it.

If anyone wants any sample code, then I shall post it here. Alternatively,
if anyone shouts No: this is not the way to do it! then I shall be
listening

Ian Marshall

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choice-of-Resource-for-my-Image-component-tp3342289p3414698.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



Re: Choice of Resource for my Image component

2011-03-25 Thread Ian Marshall
1.  I changed the image component from Image to NonCachingImage. This seems
to have eliminated my issue of images being shown which were a
previously-shown image instead of the correct one.

2.  The model which I pass to my NonCachingImage is descended from
LoadableDetachableModel. This model class's load() method returned null if
there was no image to display. I believe that this is the cause of the
exception which I was getting. If there is no image, load() now returns

  new ByteArrayResource(null, new byte[0]);

instead. I have yet to see the exception since this change.

3.  All I need to do now is find out why my use of a NonCachingImage
together with my descended LoadableDetachableModel in the form of my web
page still results in huge session size (1MB), which is forbidden in Google
App Engine.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choice-of-Resource-for-my-Image-component-tp3342289p3405585.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



Choice of Resource for my Image component

2011-03-25 Thread Ian Marshall
Hello Jim,

Could I ask you to post this in a separate topic? This one is for my choice
of resource for my Image component.

Cheers,

Ian

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Choice-of-Resource-for-my-Image-component-tp3342289p3406000.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



Choice of Resource for my Image component

2011-03-08 Thread Ian Marshall
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