cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia <tobia.confo...@linux.it>
Subject Re: Write binary data (file content) to the output stream
Date Wed, 27 Jun 2007 12:57:37 GMT
Ahmet.Tokalak@Bertelsmann.de wrote:
> generate a binary file on the fly and send it directly to the user

What you need is a reader, not an action.

If the data is already in a file, you can use the file reader:

	<!-- /downloads/myfile.zip -->
	<match pattern="downloads/*">
	  <read src="downloads/{1}"/>
	</match>

If the data is in a database, you can use the database reader:

	<reader name="db" src="org.apache.cocoon.reading.DatabaseReader">
	  <use-connection>my_database</use-connection>
	</reader>

	<!-- /binary?id=1234 -->
	<match pattern="binary">
	  <read type="db" src="{request-param:id}">
	    <parameter name="table" value="binary_objects"/>
	    <parameter name="key" value="binobj_id"/>
	    <parameter name="image" value="binobj_blob"/>
	  </read>
	</match>

If your use case is more complex, then you need to use Javascript (by
writing a piece of Flowscript) or Java (by writing a custom reader or
some Javaflow, not an action.)


Tobia

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message