0 Replies Latest reply on Mar 21, 2007 5:38 AM by kuvera

    JBoss blows mime type

    kuvera

      After my servlet is run, JBoss returns an inconsistent and usually bad http response mime type to the browser. Mostly it becomes "application/octet-stream" instead of "application/pdf" which I explicitly set. But not always... This is the output part:

      ServletOutputStream out = res.getOutputStream();
      res.setContentType("application/pdf");
      res.setContentLength((int)outfile.length());
      bis = new BufferedInputStream(new FileInputStream(outfile));
      bos = new BufferedOutputStream(out);
      byte[] buff = new byte[2048];
      int bytesRead;
      while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
      {
       bos.write(buff, 0, bytesRead);
      }
      bos.flush();
      bos.close();
      


      It used to work all the time in standalone Tomcat 5.5. The server-wide web.xml contains the pdf mime type. I don't understand this issue.