如果我们想通过Internet Explorer 11(和Edge)下载文件,则以下servlet可以工作:
private void writeFileToClient(byte[] imageData, String imageMimeType, HttpServletRequest request,
HttpServletResponse response) throws IOException
{
if (imageData != null && imageData.length > 0)
{
if (imageMimeType != null)
{
response.setHeader("Content-Type", imageMimeType);
}
response.setContentLength(imageData.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(imageData, 0, imageData.length);
ouputStream.flush();
ouputStream.close();
}
}
imageMimeType等于application / octet-stream
但是它不适用于Firefox Quantum。
有什么想法可能会丢失吗?
感谢您的帮助。