@Override protected void runInternal(CommandContext context) { final OutputFormat outputFormat = resolveOutputFormat(); @Nullable final String rootTreeIsh = this.root; @Nullable final ReferencedEnvelope bboxFilter = parseBBOX(this.bbox); @Nullable final List<String> sourceTreeNames = parseTreePahts(this.path); // setup the Export command Supplier<DataStore> targetStore = outputFormat.getDataStore(); DataStoreExportOp<?> command = outputFormat.createCommand(context); command.setTarget(targetStore); command.setSourceTreePaths(sourceTreeNames); command.setSourceCommitish(rootTreeIsh); command.setBBoxFilter(bboxFilter); final String commandDescription = outputFormat.getCommandDescription(); AsyncContext asyncContext = this.asyncContext; if (asyncContext == null) { asyncContext = AsyncContext.get(); } final AsyncCommand<?> asyncCommand = asyncContext.run(command, commandDescription); Function<MediaType, Representation> rep = new Function<MediaType, Representation>() { private final String baseUrl = context.getBaseURL(); @Override public Representation apply(MediaType mediaType) { AsyncCommandRepresentation<?> repr; repr = Representations.newRepresentation(asyncCommand, mediaType, baseUrl); return repr; } }; context.setResponse(rep); }