code: @GET
      @javax.ws.rs.Path("/zip/{path : .*}")
      @Produces("application/zip")
      public Response getDocumentsAsZip(
              @DefaultValue("") @PathParam ("path") final String  pathAsString,
                                @Context            final UriInfo uriInfo) throws IOException {
  
          final StreamingOutput streamingOutput = new StreamingOutput() {
              @Override
              public void write(OutputStream output) throws IOException, WebApplicationException {
                  try {
                      final List<Path> list = documentHelper.list( pathAsString.length() == 0 ? get("/") : get(pathAsString));
  
                      try (ZipOutputStream zipOutputStream = new ZipOutputStream(new BufferedOutputStream(output))) {
                          zipOutputStream.setLevel(9);
                          for (Path path : list) {
                              Path relativized = documentHelper.relativize(path);
  
                              zipOutputStream.putNextEntry(new ZipEntry(relativized.toString()));
  
                              Serioulizer.Stream stream = documentHelper.getStream(relativized);
                              if (stream != null) {
                                  pipe(stream.getInputStream(), zipOutputStream);
                              }
                              zipOutputStream.closeEntry();
                          }
                      }
                  } catch (Exception e) {
                      throw new WebApplicationException(e);
                  }
              }
          };
  
          String filenameWithoutExtension = Joiner.on('-')
                                                  .skipNulls()
                                                  .join( uriInfo.getBaseUri()
                                                                .getHost(),
                                                         "stnemucod",
                                                         Strings.emptyToNull( pathAsString.replace('/', ' ')
                                                                                          .replace('\\', ' ')
                                                                                          .trim()
                                                                                          .replace(' ', '_')));
  
          return ok(streamingOutput)
                 .type("application/zip")
                 .header("Content-Disposition",  "attachment; filename=\"" + filenameWithoutExtension + ".zip\"")
                 .build();
      }
docs: /*
  should read http://www.pixeldonor.com/2013/oct/12/concurrent-zip-compression-java-nio/