@ResponseBody @Override /* Streamable */ public void streamTo(OutputStream os) throws IOException { try (ZipOutputStream zos = new ZipOutputStream(os)) { for (ZipFileEntry e : this) e.write(zos); } os.flush(); }
@ResponseBody @Override /* Streamable */ public void streamTo(OutputStream os) throws IOException { try (ZipOutputStream zos = new ZipOutputStream(os)) { for (ZipFileEntry e : this) e.write(zos); } os.flush(); }
@ResponseBody @Override /* Streamable */ public void streamTo(OutputStream os) throws IOException { try (ZipOutputStream zos = new ZipOutputStream(os)) { for (ZipFileEntry e : this) e.write(zos); } os.flush(); }
@Override /* ResponseHandler */ public boolean handle(RestRequest req, RestResponse res, Object output) throws IOException, RestException { if (output.getClass() == ZipFileList.class) { ZipFileList m = (ZipFileList)output; res.setContentType("application/zip"); //$NON-NLS-1$ res.setHeader("Content-Disposition", "attachment;filename=" + m.fileName); //$NON-NLS-1$ //$NON-NLS-2$ OutputStream os = res.getOutputStream(); try { ZipOutputStream zos = new ZipOutputStream(os); try { for (ZipFileEntry e : m) e.write(zos); } catch (Exception e) { e.printStackTrace(); } finally { zos.flush(); zos.close(); } } finally { os.flush(); } return true; } return false; } }