FileHelper.zip(Collections.singletonList(file), "", temporaryFile.getAbsolutePath());
/** * Start the HTTP server that will be used to serve the artifacts * to be deployed. * * @param executor the {@link Executor} to pass to the {@link HttpServer} * @param artifacts a {@link Map} of {@link DeploymentArtifact}s to deploy * keyed by the URL path for each artifact * */ protected HttpServer createServer(ExecutorService executor, Map<String, DeploymentArtifact> artifacts) { try { LocalPlatform platform = LocalPlatform.getInstance(); InetAddress address = NetworkHelper.getFeasibleLocalHost(); int port = platform.getAvailablePorts().next(); HttpServer server = HttpServer.create(new InetSocketAddress(address, port), 0); server.createContext("/", new ArtifactsHandler(artifacts, options.asArray())); server.setExecutor(executor); server.start(); return server; } catch (IOException e) { throw new RuntimeException("Unable to create HTTP server", e); } }