<div dir="ltr">Hello,<div><br></div><div style>I have a JSP which reads a file from the local filesystem (not the vfs) and outputs it to the browser.</div><div style><br></div><div style>But the content-type I set is not taken into account. Whatever I tried the browser always gets text/html as content-type. Does OpenCms override it ?</div>

<div style><br></div><div style><br></div><div style><br></div><div style><br></div><div style>Here is a code fragment:</div><div style><br></div><div style><div><br></div><div><span class="" style="white-space:pre">  </span>ServletOutputStream outStream=response.getOutputStream();</div>

<div><span class="" style="white-space:pre">    </span>File myfile = new File("/mnt/data/"+filename);</div><div><span class="" style="white-space:pre">   </span>FileInputStream input = new FileInputStream(myfile);</div>

<div><br></div><div><span class="" style="white-space:pre">   </span>System.out.println(request.getRemoteAddr() + ": Size: " + myfile.length());</div><div><br></div><div><span class="" style="white-space:pre">     </span>response.setContentType("application/pdf");<br>

</div><div><span class="" style="white-space:pre">        </span>response.setHeader("Content-Disposition","inline;filename=" + name);</div><div><span class="" style="white-space:pre">   </span>response.setContentLength( (int) myfile.length() );</div>

<div><br></div><div><br></div><div><span class="" style="white-space:pre">  </span>int readBytes = 0;</div><div><span class="" style="white-space:pre"> </span>while((readBytes = buf.read()) != -1) {</div><div><span class="" style="white-space:pre">            </span>outStream.write(readBytes);<br>

</div><div><span class="" style="white-space:pre">        </span>}</div><div><span class="" style="white-space:pre">  </span>outStream.flush();</div><div><span class="" style="white-space:pre"> </span>outStream.close();</div><div>

<span class="" style="white-space:pre">       </span>buf.close();</div></div></div>