Brian:

This is pretty simple.  Just get the output stream from the response
object and stream the file down.  Return null from the Action's
execute method:

    private void returnFile(File f, OutputStream out) throws IOException {
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(f);
            byte[] buf = new byte[8 * 1024];
            int bytesRead;
            while ((bytesRead = fis.read(buf)) != -1) {
                out.write(buf, 0, bytesRead);
            }
        } catch (IOException ioe) {
            log.error(ioe, ioe);
        } finally {
            if (fis != null)
                fis.close();
        }
    }

On 4/26/05, Brian McGovern <[EMAIL PROTECTED]> wrote:
> I'm wondering if anyone has any tips on how to render a pdf with struts.  I 
> want to mask the name of the pdf and just stream it to client.
> 
> Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to