However if you really only in the serializer can detect what you're streaming back then this is no good either.
Thanks for the insight! Jorg
Sylvain Wallez wrote:
Jorg Heymans wrote:
Luigi Bai wrote:
Hi,
I've got a XML database with images of various sorts of mime-types (jpeg, gif, png, etc) stored in text() nodes as Base64. I have a trivial Base64Serializer that reconstitutes them on the way out. However, I think I'm stuck with a mime-type problem. It seems I have to have a separately instantiated Serializer for each possible mime-type:
correct
<map:select type="mimeSelector"> <map:when test="image/png"> <map:serialize type="base64" mime-type="image/png" /> </map:when> ...etc...
I find this verbose, and annoying to maintain if someone saves an image with a new mime-type.
i agree, others might not.
The Serializer interface has a getMimeType() method which allows a Serializer to declare its mime-type, but only at setup() time (correct me if I'm wrong?). I need to declare the mime-type later; the first
correct. getMimeType() is called during setup() which is called during pipeline setup before any data is processed.
IIRC it works this ways so that cocoon can start streaming SAX events to the client as they roll in, and doesn't have to wait until the serializer is fully finished processing.
The serializer's mime-type attribute is evaluated and can therefore contain variables. But as variable expansion occurs at pipeline build time and not during it's execution, that information has to be made available e.g. using an action, which can be a simple rewriting of your mimeSelector.
<map:act type="mimeChooser"> <map:serialize type="base64" mime-type="{chosen-mime-type}"/> </map:act>
Sylvain
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
