You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by DURDINA Michal <Mi...@assetsoft.sk> on 2003/11/08 17:39:56 UTC

Custom protocol for ResourceReader

Hello!

I am considering to use ResourceReader for accessing a stream gathered from backend system. This stream will be either pdf or xls - the backend provides these two formats. I am considering to create my own protocol implementation for the reader, that would provide access to the stream, that I get in the action. Action and reader will probably communicate via specific request attribute.

Sitemap fragment:
<map:match pattern="*.pdf">
	<map:act type="GetStreamFromBackend">
		<!-- action will save result to request attribute e.g. 'pdf-stream'-->
		<map:read src="requestAttr://pdf-stream"/>
	</map:act>
</map:match>

Do you think this is a good idea?
Does you know any better mechanism, how to pass a stream from the action directly to the HTTPResponse bypassing any pipeline?

I am using Cocoon 2.0.4 for this time.

Thank you for thinking over.
Michal

PS: Excerpt from ResourceReader.java (C2.0.4)
...
    public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
    throws ProcessingException, SAXException, IOException {
        super.setup(resolver, objectModel, src, par);
        this.inputSource = this.resolver.resolve(super.source);
    }
...