cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: returning images directly
Date Tue, 25 Jul 2000 16:23:29 GMT
1. Generate binary data inside an XML page, like this

<page>
asjdflkajsdlkfjaslkfjlksd
</page>

2. Implement org.apache.cocoon.formatter.Formatter, creating a 
BinaryFormatter class. It should be very simple - just take the text node 
out of the page element and write it out.

3. Add this new BinaryFormatter class to cocoon.properties

4. Use the cocoon-format tag at the top of the page, to specify the binary 
formatter.

Hey presto, you're done!

(But using a servlet would still be more efficient.)


--
Robin Green
i-tao Ltd.
4 Skyline Village
Limeharbour
London E14 9TS
United Kingdom
Phone +44 20 7537 2233  Fax +44 70 8081 5118
http://www.i-tao.com



Chris Meyer <cmeyer@ultratask.com> asked:
>>>  Is there any way to use cocoon to return images directly? Something
>>>  along the lines of:
>>>
>>>
>>>
>>>  <xsl:logic>
>>>
>>>  response.setContentType( "image/gif" )
>>>  writeMyImageFileToOutput( "myfilename.gif", response.getOutputStream() 
>>>);
>>>
>>>  </xsl:logic>
>>
>>try response.sendRedirect("myfilename.gif")
>>
>>- donald
>
>Unfortunately this won't work as far as I can tell -- I don't want to
>redirect to a web page. I want to send an image directly to the user.
>This is in order that the image is a 'protected' resource on the
>system (i.e., the user must log in to the web site in order to have
>access to the image). The file is not located in any public area (and
>in fact may be generated on the fly).
>
>When using servlets directly, you can stream out the data to the
>output stream. Under Cocoon, it specifically has as its goal to have
>no output stream (I read this in Stephan's slides). So how is the
>best way to return generated binary data like images?
>
>Any other ideas?

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message