You'll have to back up in the code some and see how the writer is being used. If nothing has been written already, then you can copy the InputStream to the Writer.

If your code is being called from the screen widget, then things get tricky - since it has probably already sent out HTML text to the browser.

It would be handy to have a generic view handler for this kind of scenario.


Chris Howe wrote:

It won't let me do response.getOutputStream.  I get an error that says "getWriter() 
has already been called for this response"

----- Original Message ----
From: Adrian Crum <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, November 21, 2007 9:45:47 AM
Subject: Re: Write to Browser


FileInputStream zipInStream = new FileInputStream(zipFile);
OutputStream browserOutStream = response.getOutputStream();
response.setContentLength((int)zipFile.length());
response.setContentType("application/zip");
// Call a routine to copy bytes from zipInStream to browserOutStream

-Adrian

Chris Howe wrote:

I'm trying to create a zip file on the fly.  I've created it properly

 so that it will write to the file system, but I would prefer to write
 to the browser so that the user can download it.  This seems like it
 should be so simple, but I'm missing it.  TIA for any help!

Chris










Reply via email to