cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeroen Reijn" <>
Subject RE: Write binary data (file content) to the output stream
Date Wed, 27 Jun 2007 11:42:43 GMT

do you already have your binary file or are you creating the file? If you have the file already,
you could use a cocoon reader and set some extra http headers.

Otherwise I would go for creating your own reader.

There is already a set header action available in case you wish to set the Content-Disposition.
See the example below

<map:act type="set-header">
  <map:parameter name="Content-Disposition" value="attachment;"/>


Jeroen Reijn

-----Original Message-----
From:	Christian Schlichtherle []
Sent:	Wed 27-6-2007 13:26
Subject:	RE: Write binary data (file content) to the output stream

I wonder if you really need a pipeline for your example, a simple Servlet
may actually be the best option.
If your binary file would be the result of a transformation however, I would
recommend to write a Serializer component.
Kind regards,


From: [] 
Sent: Wednesday, June 27, 2007 1:10 PM
Subject: Write binary data (file content) to the output stream

Hi all, 
i wanna open a generate a binary file on the fly and write send it directly
to the user.
I didn't found an easy way in cocoon to achieve this.
Therefore i have tried using an action, which gets the output stream and
writes the byte array into the stream.

response.setHeader("Content-Disposition", "attachment; filename=" +

OutputStream out = response.getOutputStream();




the sitemap.xmap looks like this:
<map:match pattern="**">

<map:act type="binary-download"/>


It does function, but when i open in an editor, then i see the file content
followed by an cocoon error message saying that a ResourceNotFoundException
has been occured.
1. Any idea why i get the message?
2. Is there a better way sending binary data without writing it to the
Thanks in advance.

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

View raw message