public void write(OutputStream output) throws IOException,
            ServiceFormattedException {
          ZipOutputStream zip = new ZipOutputStream(output);
          try {
            HdfsApi api = getApi();
            Queue<String> files = new LinkedList<String>();
            for (String file : request.entries) {
              files.add(file);
            }
            while (!files.isEmpty()) {
              String path = files.poll();
              FileStatus status = api.getFileStatus(path);
              if (status.isDirectory()) {
                FileStatus[] subdir;
                try {
                  subdir = api.listdir(path);
                } catch (AccessControlException ex) {
                  LOG.error("Error zipping directory {}/ (directory ignored) : ", path.substring(1), ex);
                  continue;
                }
                for (FileStatus file : subdir) {
                  files.add(org.apache.hadoop.fs.Path
                      .getPathWithoutSchemeAndAuthority(file.getPath())
                      .toString());
                }
                zipDirectory(zip, path);
              } else {
                zipFile(zip, path);
              }
            }
          } catch (Exception ex) {
            LOG.error("Error occurred: " ,ex);
            throw new ServiceFormattedException(ex.getMessage(), ex);
          } finally {
            zip.close();
          }
        }
Download ZIP of passed file list
@param request download request
@return response with zip
contrib/views/files/src/main/java/org/apache/ambari/view/filebrowser/DownloadService.java