in taverna-download-impl/src/main/java/org/apache/taverna/download/impl/DownloadManagerImpl.java [149:167]
private void downloadToFile(URI source, Path destination) throws DownloadException {
try {
// We want to handle http/https with HTTPClient
if (source.getScheme().equalsIgnoreCase("http") || source.getScheme().equalsIgnoreCase("https")) {
Request.Get(source).userAgent(getUserAgent()).connectTimeout(TIMEOUT).socketTimeout(TIMEOUT).execute()
.saveContent(destination.toFile());
} else {
// Try as a supported Path, e.g. file: or relative path
try {
Path path = Paths.get(source);
Files.copy(path, destination, StandardCopyOption.REPLACE_EXISTING);
} catch (FileSystemNotFoundException e) {
throw new DownloadException("Unsupported URL scheme: " + source.getScheme());
}
}
} catch (IOException e) {
throw new DownloadException(String.format("Error downloading %1$s to %2$s.", source, destination), e);
}
}