Hi,

I'm using Cocoon 2.1.10.

I've implemented a class which extends AbstractReader. It uses some SOAP calls to pull some binary gif image data from a remote system. It implements CacheableProcessingComponent as well, and my getValidity() method is simply:

        private static final long VALID_FOR = 2 * 60 * 60 * 1000; // 2 hours

        public SourceValidity getValidity() {
SourceValidity validity = new ExpiresValidity(System.currentTimeMillis() + VALID_FOR);
                return validity;
        }

Some of the products that I'm getting images for don't actually have images, so in those cases I throw a ResourceNotFoundException from my generate() method. The cacheing pipeline which serves the image has a map:handle-errors section which serves up a default image instead.

My problem is that the resource is not cached if I throw a MissingResourceException. How can I change the way I'm doing this so that even a "missing resource" response is cached? At the moment, products with no icons cause the remote system to be hit every time, and the SOAP calls are quite slow.

The only thing I can think of is to stream the default image data out of my reader if the product has no image, by directly opening the default image file from disk inside the reader. Is there a better way?

Thanks

Jon

PS happy christmas everyone!

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

Reply via email to