Re: Streaming files to Firefox
- From: "Adam P. Jenkins" <news@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 30 Apr 2005 15:45:23 -0400
WJ wrote:
I have some simple code that reads a file from disk and streams it to a web browser.
The servlet container is Tomcat 5.0.28 IE 6.0.3790 Firefox 1.0.3
This works for IE, but not Firefox:
ServletOutputStream out = res.getOutputStream(); File testFile = new File("C:/temp/MyTestPDF.pdf");
res.setHeader("Content-Type","application/pdf"); res.setHeader("Content-Length","4230364"); res.setHeader("Content-Disposition", "inline; filename=\"MyTestPDF.pdf");
int bufferSize; byte[] buffer=new byte[2048]; FileInputStream fis=new FileInputStream(testFile); while( (bufferSize=fis.read(buffer)) != -1) out.write(buffer, 0, bufferSize); out.close();
Now, if I change the Content-Disposition to this: res.setHeader("Content-Disposition", "attachment; filename=\"MyTestPDF.pdf"); Both browsers correctly prompt me to open or download the file.
I want the file to stream (eventually into a new window) without being prompted. Any help is greatly appreciated!
You didn't mention what error you get from Firefox. Probably you just need to enable the Acrobat Reader plugin under Firefox to make inline PDFs work.
.
- Follow-Ups:
- Re: Streaming files to Firefox
- From: WJ
- Re: Streaming files to Firefox
- From: WJ
- Re: Streaming files to Firefox
- References:
- Streaming files to Firefox
- From: WJ
- Streaming files to Firefox
- Prev by Date: Streaming files to Firefox
- Next by Date: Re: Streaming files to Firefox
- Previous by thread: Streaming files to Firefox
- Next by thread: Re: Streaming files to Firefox
- Index(es):
Relevant Pages
|
|