Hi Jeroen, in some cases i read the file from the database depending on the parameters passed by the user. Sometimes i create the file on the fly. I thought that this is a very common requirement that it should be solved easily without writing a new reader or anything else. Greetings, Ahmet
________________________________ Von: Jeroen Reijn [mailto:[EMAIL PROTECTED] Gesendet: Mi 27.06.2007 13:42 An: [email protected]; [email protected] Betreff: RE: Write binary data (file content) to the output stream Hi, 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;"/> </map:act> Regards, Jeroen Reijn -----Original Message----- From: Christian Schlichtherle [mailto:[EMAIL PROTECTED] Sent: Wed 27-6-2007 13:26 To: [email protected] Cc: Subject: RE: Write binary data (file content) to the output stream Hi, 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, Christian _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 27, 2007 1:10 PM To: [email protected] 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.setContentType("application/x-octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=" + filename); OutputStream out = response.getOutputStream(); out.write(data); out.flush(); ... the sitemap.xmap looks like this: <map:match pattern="**download.do"> <map:act type="binary-download"/> </map:match> 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 filesystem? Thanks in advance. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
<<winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
