cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: Protecting Binary Files
Date Fri, 22 Dec 2000 13:33:39 GMT


Matthew Smith a écrit :
> 
>         It's a Content-Disposition header.  Some versions of Netscape don't seem to
> recognize it.  Use the value "attachment; filename='thisfile.bin'", where
> thisefile.bin is obviously the filename you want to sudgest.

Thanks, I tried it and it solved some of the problems cocoon has with IE
for PDF generation (see my next post).

>         I'm a novice with JSP.  Could you give me somewhere to start for the http
> headers and the file passthrough?  The security stuff will probably just
> come directly from the methods I wrote for my own authorization taglib.
> 
> Thanks,
> Matt
> 

For http headers use HttpServletResponse.addHeader()
In an XSP, it's as follows :
<xsp:logic>
  response.addHeader("Content-Disposition", "attachment;
filename=thisfile.bin");
</xsp:logic>

For the file transfer stuff, you should have a look at Tomcat's internal
file serving servlet. It's implemented in the FileHandler inner class in
org.apache.tomcat.request.StaticInterceptor.

Hope this helps

> -----Original Message-----
> From: Sylvain Wallez [mailto:sylvain.wallez@anyware-tech.com]
> Sent: Thursday, December 21, 2000 4:35 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: Protecting Binary Files
> 
> As far as I know, this is not possible with Cocoon 1, since it can only
> return character content (formatters work with a java.io.Writer). This
> will however be possible with Cocoon 2.
> 
> With Cocoon 1, I solved this problem by forwarding the request to a
> dedicated file-serving servlet.
> 
> Could you please tell us the headers you add to suggest a filename to
> the client ? I searched it unsuccessfully in the HTTP RFC and I think it
> could be a way to solve the recurrent "IE cannot display dynamic PDF"
> thread on this list.
> 
> Matthew Smith a écrit :
> >
> >         I'm currently using Cocoon to authorize users, with the same type
> of method
> > as in the contributed auth taglib, validating on a database and then
> > defining an authorized session.  I'd like to use this same method to
> protect
> > binary files.  Can I do this through Cocoon?
> >         I did this with PHP by making the file request a parameter to a
> script.
> > The script would send an http header type for binary files and then
> another
> > to sudgest the proper filename to the client, and then send the actual
> file
> > as output instead of any html.  Can I do something similair with Cocoon,
> or
> > atleast with JSP?
> >
> > Thanks,
> > Matt
> >
> 
> --
> Sylvain Wallez
> Anyware Technologies
> 
-- 
Sylvain Wallez
Anyware Technologies

Mime
View raw message