I have a servlet that generates a pdf file, and returns it inline to be displayed by the browser:
res.setContentType("application/pdf");
res.setHeader("Content-disposition", "inline; filename=arajanlat.pdf");
bos = new BufferedOutputStream(out);
// Simple read/write loop sends the bytes
Sometimes the browser brings up the Adobe Reader plugin, but more frequently it displays a Save As window, saying the mime type is application/octet-stream.
It used to work all the time in standalone Tomcat. The server-wide web.xml contains the pdf mime type. Can you give me a hint?
Another question: even if the plugin shows, if I want to save the pdf, the offered filename will be the servlets path, not the filename I specified above. Is there a solution for this?
One more thing: it comes through an Apache server with mod_jk, if it matters, but actually the only change I made was replacing Tomcat with JBoss.