I'm posting the cause of this issue because we discussed it via email. This was caused by interaction with the GZIPFilter, it worked OK when the filter was removed.
Cheers, Julian tonylu880042 wrote: > > The decorator.xml is already exclude the action. > But the problem still there > > tonylu880042 wrote: >> >> This problems is not caused by appfuse. >> If someone have been encountered this problem please give me some advice. >> I wrote an action let user select some file store in the web site and let >> them package download by ZipOutputStream. >> The problem is the generated zip file can not open because header section >> is broken. I have no idea what happen to the action. If I change the >> OutputStream from ServletOutputStream to FileOutputStream the generated >> Zip file can be open correctly. >> I list my ZipOutputStream code as following. The full file is in the >> attachment. >> Any suggestion will be appreciated. >> Best Regards, >> tony http://www.nabble.com/file/7243/PackZipAction.java >> PackZipAction.java >> >> CheckedOutputStream checksum = new >> CheckedOutputStream(response.getOutputStream(), new Adler32()); >> ZipOutputStream zos=new ZipOutputStream(new >> BufferedOutputStream(checksum)); >> zos.setMethod(ZipOutputStream.DEFLATED); >> for(int i=0;i<selectedAry.size();i++) >> { >> FileInputStream fileinputstream; >> File file = new File(_path.toString()); >> ZipEntry ze= new ZipEntry(i+"-"+file.getName()); >> ze.setSize(file.length()); >> ze.setTime(file.lastModified()); >> >> CRC32 crc32 = new CRC32(); >> int n; >> byte [] rgb = new byte [1000]; >> fileinputstream = new FileInputStream(file); >> while ((n = fileinputstream.read(rgb)) > -1) >> { >> crc32.update(rgb, 0, n); >> } >> >> fileinputstream.close(); >> ze.setCrc(crc32.getValue()); >> zos.putNextEntry(ze); >> >> fileinputstream = new FileInputStream(file); >> BufferedInputStream bis = new >> BufferedInputStream(fileinputstream); >> byte[] bytes = new byte[bis.available()]; >> bis.read(bytes); >> zos.write(bytes); >> bis.close(); >> zos.closeEntry(); >> } >> zos.close(); >> zos = null; >> >> > > -- View this message in context: http://www.nabble.com/Problems-with-ZipOutputStream-tf3422216s2369.html#a9572219 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
