Hi Tobia,

On Dec 20, 2007 12:47 PM, Tobia Conforto <[EMAIL PROTECTED]> wrote:
> Jon Evans wrote:
> > I've implemented a class which extends AbstractReader. It uses some
> > SOAP calls to pull some binary gif image data from a remote system.
> > My problem is that the resource is not cached if I throw a
> > MissingResourceException.
> > 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.
>
> Yes, I think this is the best course of action.
>
> You might want to make the path to the default image a configuration
> parameter, of course, so that you won't have to recompile your reader
> when the path changes, or if you want different default images for
> different products.

Thanks, I have got it working now. I couldn't get a Configurable
component to work for some reason, so I ended up with a Parametizable
one which is just as good for my purposes because there's only one
instance of it in the sitemap. I pass in a default image url prefixed
with context:// and I look it up inside the reader with SourceResolver
when I need it. It seems to work fine.

How would I have made it work as a Configurable reader? I had this in
my sitemap:

<map:read type="conceptimage" mime-type="image/gif" src="{1}"/>
  <map:parameter name="defaultFilename"
    value="context://images/default.gif"/>
</map:read>

but from the reader's configure() method,
config.getAttribute("defaultFilename") just threw an exception.

Thanks also Ard for your suggestions.

Jon

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

Reply via email to