hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalyan Enganti" <kalyanenga...@gmail.com>
Subject Writing Zipoutputstream to outputstream blocking requests
Date Sun, 23 Sep 2012 15:50:11 GMT
Hi I am working on an android file explorer application. When a large folder is requested for
download I am zipping the folder and writing its contents to the outputstream using the code
below.But any further requests are blocked until the file is downloaded.The createZipFile()
method takes file name and ouputstream and returns OutPutStreamWriter object.What could be
the problem ?Should I consider moving this to a thread?I have tried many variations already
and none seem to work.Any pointers in the right direction would be greatly appreciated.

        if(f.isDirectory()&& action.equalsIgnoreCase("download")){        File zip=new
File(file);        entity = new EntityTemplate(new ContentProducer() {            public void
writeTo(final OutputStream outstream) throws IOException {                action=null;   
            OutputStreamWriter writer=fileop.createZipFile(file, outstream);             
  writer.flush();            }        });response.setHeader("Content-Type", "application/zip");
       response.setHeader("Content-Disposition","attachment; filename=\"" +zip.getName()+".zip\"");
       response.setEntity(entity);    }Thanks Kalz
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message