Hi,

we're rendering some charts using JFreeChart and
RenderedDynamicImageResource (that combination is pretty neat, by the
way). However, RenderedDynamicImageResource caches its image data,
even when I call setCacheable(false). When I refresh the page using
AJAX, for example, I get the same image, even though the underlying
model data has changed.

I worked around this by creating a
NonCachingRenderedDynamicImageResource:

public abstract class NonCachingRenderedDynamicImageResource extends
  RenderedDynamicImageResource { 

public
  NonCachingRenderedDynamicImageResource(int width, int height)
{ super(width, height); }

    @Override
    protected byte[] getImageData() {
        return render();
    }
}

I'm simply overwriting getImageData() to skip the caching logic in
there. This seems to work fine.

I'm wondering, however, whether this is really the right way to go
about this. Should RenderedDynamicImageResource maybe check the
cacheable flag before actually caching the image data? If so, I could
provide a patch.

Thanks
Carl-Eric
www.wicketbuch.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to