I have to download a pdf file and am using
Servlets and xml, xsl.
I am facing a very peculiar problem, I am able to download the file in netscape v 4.73, but not in IE v 5.0.
The sample code is as mentioned below:
OutputStream outStream = response.getOutputStream();
response.setContentType("application/pdf");
FileInputStream fileInput = new FileInputStream(fileName);
int numOfBytes = fileInput.available();
byte byteArray[] = new byte[numOfBytes];
int nextByte = fileInput.read(byteArray);
fileInput.close();
OutputStream outStream = response.getOutputStream();
outStream.write(byteArray);
outStream.close();
Note: here response is HttpServletResponse.
I have changed the setContentType to application/x-filler & application/octet-stream. These two work fine in IE but donot work in netscape. In netscape the downloaded file is saved as .html.
When I retain the contentType as application/pdf, the IE download goes into a loop and hangs.
CAN ANYBODY HELP ME. I am in a very crucial stage of my project. Any help in this regard would be appreciated.
PS: Kindly feel free to reply to me regarding any other method by which I can download a pdf file using servlets.
Regards.
Vandana