use of org.apache.archiva.webdav.util.IndexWriter in project archiva by apache.
the class ArchivaDavResource method spool.
@Override
public void spool(OutputContext outputContext) throws IOException {
if (!isCollection()) {
outputContext.setContentLength(Files.size(localResource));
outputContext.setContentType(mimeTypes.getMimeType(localResource.getFileName().toString()));
}
try {
if (!isCollection() && outputContext.hasStream()) {
Lock lock = fileLockManager.readFileLock(localResource);
try (InputStream is = Files.newInputStream(lock.getFile())) {
IOUtils.copy(is, outputContext.getOutputStream());
}
} else if (outputContext.hasStream()) {
IndexWriter writer = new IndexWriter(this, localResource, logicalResource);
writer.write(outputContext);
}
} catch (FileLockException e) {
throw new IOException(e.getMessage(), e);
} catch (FileLockTimeoutException e) {
throw new IOException(e.getMessage(), e);
}
}
use of org.apache.archiva.webdav.util.IndexWriter in project archiva by apache.
the class ArchivaVirtualDavResource method spool.
@Override
public void spool(OutputContext outputContext) throws IOException {
if (outputContext.hasStream()) {
Collections.sort(localResources);
List<Path> localResourceFiles = new ArrayList<>();
for (Path resourceFile : localResources) {
if (Files.exists(resourceFile)) {
localResourceFiles.add(resourceFile);
}
}
IndexWriter writer = new IndexWriter(this, localResourceFiles, logicalResource);
writer.write(outputContext);
}
}
Aggregations