3 Replies Latest reply on Jul 15, 2011 5:09 PM by Peter Johnson

    Reading a remote file from Servlet

    Joseph Mokenela Newbie




      I have a bit of a problem here, I would like to what could be wrong here. I have built web application that reads a pdf file from a remote drive and display in on the browser, The application works perfectly on my machine, (running Windows 7) But the same application doesn't work when I deploy it on the test environment(running Windows Server 2003), Both machines are runnning Jboss-5.1.0.  The only difference is that on the test environment, that Jboss runs as a service.



      Thanks in advance


        • 1. Re: Reading a remote file from Servlet
          Peter Johnson Master

          Need a few more details


          1) Is your app modifying the pdf in any way or is it simply serving the pdf as-is?


          2) Does you app change the mime type of its response, and if so, what mime type are you using?


          3) Does the same mime type appear in the web.xml, either the one for your app or the global one in JBoss AS?


          4) In both cases, are you using the exact same browser? For example, in both cases you are using the IE browser on your Win 7 desktop. If not, does it still have the same issue when you do?

          • 2. Re: Reading a remote file from Servlet
            Joseph Mokenela Newbie

            The application is serving a pdf as is. It doesn't change the mime type. On the win7 destop I use Firefox 5.0 and on the other machine its IE8.

            • 3. Re: Reading a remote file from Servlet
              Peter Johnson Master

              I think you need to do two things. First, you need to know the mime type used to send the pdf to the browser (the default ype of text/html used by a servlet ain't gonna work! By the way, exactly how is the PDF transported? Form your earlier post I assumed that you had something like a servlet read the PDF file and ship the bytes to the browser, but your latest post has me thinking that all you have is a link to the pdf file on a web page, which means that JBoss AS would serve it directly without any action on the part of your app). Then you need to determine whether IE8 is configured to handle that mime type.


              I assume that you tried switching browsers? In other words, what happens with IE8 (or 9) on your dev machine and with FireFox on the test server.


              Essentially, it is the mime type that tells your bowser what kind of information is coming from the server. So this requires two things: first, the server nust send the proper mime type for the data stream, second the brorser must be configured to recognize the mime type so that it can properly handle the data stream.