Note that there are some explanatory texts on larger screens.

plurals
  1. POFile download code gives error in IE, All's fine in other browsers
    primarykey
    data
    text
    <p>I wanted to write a code to download a file from some location.</p> <pre><code>String filePath = policyLocation; File f = new File(filePath+"/"+fileName); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\""); response.setContentLength((int) f.length()); BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(f)); byte buffer[] = new byte[8 * 1024]; java.io.PrintWriter out = response.getWriter(); OutputStream out_s = new Writer2Stream(out); copyStreamsWithoutClose(fileInput, out_s, buffer); fileInput.close(); out_s.flush(); public static void copyStreamsWithoutClose(InputStream in, OutputStream out, byte[] buffer) throws IOException { int b; while ((b = in.read(buffer)) != -1) out.write(buffer, 0, b); } </code></pre> <p>but it gives an error for IE browsers only. All's fine for Firefox and Chrome</p> <pre><code>java.io.FileNotFoundException: D:\jboss-4.2.0.GA\Policies\HR (Access is denied) java.io.FileInputStream.open(Native Method) java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:106) com.edifixio.ems.policiesandforms.action.PolicyFileDownloader.downloadHRPolicyFile(PolicyFileDownloader.java:34) com.edifixio.ems.servlet.FileDisplayServlet.doPost(FileDisplayServlet.java:271) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload