Hey all, my problem is i am downloading some files via http using Jboss 4.0 and i get 3 extra cr-lf at the end of the files i download (zip, pdf, txt... all the files have 6 extra bytes at the end). My code is in a jsp:
<%@ page import="java.io.File, java.io.InputStream, java.io.FileInputStream, java.io.OutputStream"%> <%@ page session="false" %> <% String contentType = (String)application.getAttribute("fileupload_type"); String fileName = (String)application.getAttribute("fileupload_name"); String allowCache = "true"; String openDirectly = "false"; if(allowCache == null || allowCache.equalsIgnoreCase("false")) { response.setHeader("pragma", "no-cache"); response.setHeader("Cache-control", "no-cache, no-store, must-revalidate"); response.setHeader("Expires", "01 Apr 1995 01:10:10 GMT"); } if(contentType!=null) { response.setContentType(contentType); } if(fileName != null) { fileName = fileName.substring(fileName.lastIndexOf('\\')+1); fileName = fileName.substring(fileName.lastIndexOf('/')+1); StringBuffer contentDisposition = new StringBuffer(); if(openDirectly==null || openDirectly.equalsIgnoreCase("false")) { contentDisposition.append("attachment;"); } contentDisposition.append("filename=\""); contentDisposition.append(fileName); contentDisposition.append("\""); response.setHeader ("Content-Disposition", contentDisposition.toString()); } byte[] bytes = (byte[])application.getAttribute("fileupload_bytes"); if (bytes != null) { response.setContentLength(bytes.length); response.getOutputStream().write(bytes); response.getOutputStream().flush(); response.getOutputStream().close(); response.flushBuffer(); %> Thanks for your help. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054473#4054473 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054473 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user