Re: Streaming files to Firefox



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.
.




Relevant Pages

  • Re: Question about positionning.
    ... I observed something strange in Firefox which let me study precisely the ... section 10.3.7 of the specifications of CSS2 and I have a question about it. ... whether the box was originally inline or block, ... But that's expecting the browser to take the hypothesis a bit far I ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Streaming files to Firefox
    ... I'd expect the behavior to be client-dependent based on the browser ... > I have some simple code that reads a file from disk and streams it to ... but not Firefox: ... > Both browsers correctly prompt me to open or download the file. ...
    (comp.lang.java.programmer)
  • Re: IE launching when Firefox is default browser
    ... After making FireFox my default ... went to the Links folder on my ... default browser via the Control Panel>Add/Remove Programs>Set Program Access ... Replies are posted only to the newsgroup for the benefit or other readers. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Where is the notificiation about IE zero day vulnerablity?
    ... > protected your Firefox web client. ... > talking about how it was poised to be the one browser to finally ... some only the local news and others the weather. ... already reporting it - report the problem as well.. ...
    (microsoft.public.security)
  • [Full-disclosure] MDKSA-2005:120 - Updated mozilla-firefox packages fix multiple vulnerabilities
    ... A number of vulnerabilities were reported and fixed in Firefox 1.0.5 ... In several places the browser UI did not correctly distinguish between ... If an attacker can convince a victim to use the "Set As Wallpaper" ...
    (Full-Disclosure)