cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia <>
Subject Re: Write binary data (file content) to the output stream
Date Wed, 27 Jun 2007 12:57:37 GMT 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/ -->
	<match pattern="downloads/*">
	  <read src="downloads/{1}"/>

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

	<reader name="db" src="org.apache.cocoon.reading.DatabaseReader">

	<!-- /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"/>

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.)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message