1. The main point is that webapps using cocoon/fop to generate pdf's
containing dynamic images will go slower and eventually get an
OutOfMemoryError as the fop cache consumes all memory.

To work around this the webapp will have to call
org.apache.fop.image.FopImageFactory.resetCache().

2. A secondary point is that the webapp will always get the cached
first version of the image instead of the new dynamic content.

To work around this the webapp needs to use a "dummy parameter" to make
the URL different each time. However this gives rise to the problem in
the main point above.

Webapps shouldn't need to implement these two work arounds.
It would be nicer if the webapp could somehow tell fop which images are
dynamic and shouldn't be cached. Maybe fop's userconfig.xml could
include patterns for image URLs to be included and/or excluded from the
cache.

I'm about to try another work around, that is to include the image as
inline svg with <fo:instream-foreign-object> and thus avoid unwanted caching.

Cheers,
        Neil.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of J.Pietschmann
Sent: Thursday, 14 August 2003 5:08 AM
To: [EMAIL PROTECTED]
Subject: Re: fop image caching


neil wrote:
> Maybe it should be called after rendering every page

This would defeat the purpose of caching, wouldn't it? Anyway, this
would mean calling it from within FOP, which isn't something Cocoon
can do for you. Also, the images are kept for referencing purposes
and possibly delayed serializing until the end of a rendering anyway.

> Is it safe to call this method while images are being rendered (for other requests)?

It should be safe with the most recent FOP release. I don't recall
anyone claiming to have tested this though.

> If you have a servlet that generates a different image each time it is called 
with the same URL
> you need to use a constantly changing dummy parameter on the URL to avoid caching.

This is for getting dynamically generated images. For example, if you
use
   <fo:extarnal-graphic src="http://localhost:9000/current-time-image.png"/>
multiple times, all the images will show the same date/time. If you want
to have the actual time the image was generated, you have to use the
dummy parameter so that each fo:external-graphic has its own unique
source URL.
Note that this *increases* cache load, probably exactly the opposite of
what you want to achieve.

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to