Follow Up:  This works but im having a little trouble outputting the content 
type appropriately.

-B

-----Original Message-----
From: Nick Heudecker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 26, 2005 1:47 PM
To: Struts Users Mailing List
Subject: Re: PDF Streamed To Client


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]


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

Reply via email to