I have a Servlet that returns a csv file that "works" through HTTP in Internet Explorer and Firefox. When I execute the same Servlet via HTTPS, only firefox continues to download the csv file via HTTPS. I do not think this is necessarily an Internet 6 or 7 issue described on MSDN :
Message:
Internet Explorer could not download data.csv from mydomain.com Internet Explorer could not open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
Please note that after this message the site continues to "up", and you can continue browsing the site, namely downloading the CSV that requests this message. I managed to access similar files via https in IE from other j2ee applications, so I believe this is our code. Should I not close bufferedOutputStream?
UPDATE
to close or not to close the output stream: I asked this question on the java posse forums and discussion , there is also insight. In the end, it seems that no container should rely on the "client" (your servlet code in this case) to close this output stream. Therefore, if your refusal to close a thread in a servlet causes a problem, it is more a reflection of the poor implementation of your servlet container than your code. I posted the IDE and tutortials behavior from Sun, Oracle and BEA and how they are also incompatible in whether they close the stream or not.
About the specific behavior of IE . In our case, a separate product "Oracle Web Cache" introduced additional header values ββthat affect Internet Explorer only because IE implements the "No Cache" ("No Cache" requirement; see MSDN article ). The code:
public class DownloadServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletOutputStream out = null; ByteArrayInputStream byteArrayInputStream = null; BufferedOutputStream bufferedOutputStream = null; try { response.setContentType("text/csv"); String disposition = "attachment; fileName=data.csv"; response.setHeader("Content-Disposition", disposition); out = response.getOutputStream(); byte[] blobData = dao.getCSV();
java java-ee servlets
Brian hart
source share