BTW, the code for streaming a servlet works perfectly as a stand alone servlet, but fails for IE in the struts framework.
Sheldon > -----Original Message----- > From: Chan, Sheldon > Sent: Monday, February 03, 2003 9:36 AM > To: '[EMAIL PROTECTED]' > Subject: Streaming PDF file problem > > Hi all, > > I'm trying to stream a PDF from a Struts action by writing an array of > bytes to the OutputStream of HttpServletResponse. It works great in > Mozilla, however it fails on IE. When I attempt to execute the action, IE > brings up its "Save or Open" dialogue box with the request Url as the file > it's trying to save. When I click on "Save", it gives me an error > dialogue of "Internet Explorer cannot download... ". Any ideas? > > Thanks in advance for any help. > > Sheldon > > > Here's the psuedo-code. > > OutputStream outputstream = null; > > try { > byte[] responseBytes = getBody().getBytes(ENCODING); > > response.setContentType("application/pdf"); > response.setContentLength(responseBytes.length); > response.setHeader("Content-Disposition", > "attachment; filename=myfile.pdf"); > response.setHeader("Pragma", "no cache"); > response.setHeader("Cache-Control", "no-cache"); > > outputStream = response.getOutputStream(); > > outputStream.write(responseBytes, 0, responseBytes.length); > } catch (Exception e) { > // do something > } finally { > outputStream.close(); > } > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]