|
51 | 51 | import java.io.File; |
52 | 52 | import java.io.IOException; |
53 | 53 | import java.net.http.HttpClient; |
| 54 | +import java.net.http.HttpRequest; |
54 | 55 | import java.nio.file.Path; |
55 | 56 | import java.util.*; |
56 | 57 | import java.util.function.BooleanSupplier; |
| 58 | +import java.util.function.Consumer; |
57 | 59 |
|
58 | 60 | import static eu.europa.ec.itb.validation.commons.web.Constants.*; |
59 | 61 |
|
@@ -519,28 +521,29 @@ private List<FileInfo> getExternalFiles(DomainConfig domainConfig, String[] exte |
519 | 521 | String artifactType, File parentFolder) throws IOException { |
520 | 522 | List<FileInfo> artifacts = new ArrayList<>(); |
521 | 523 | if (externalContentType != null) { |
| 524 | + Consumer<HttpRequest.Builder> requestDecorator = fileManager.createRemoteFileRequestDecorator(domainConfig, artifactInfo); |
522 | 525 | for (int i=0; i<externalContentType.length; i++) { |
523 | 526 | if (StringUtils.isNotBlank(externalContentType[i])) { |
524 | 527 | FileInfo fileInfo = null; |
525 | 528 | if (CONTENT_TYPE_FILE.equals(externalContentType[i])) { |
526 | 529 | if (!externalFiles[i].isEmpty()) { |
527 | 530 | try (var stream = externalFiles[i].getInputStream()) { |
528 | | - fileInfo = new FileInfo(fileManager.getFileFromInputStream(parentFolder, stream, FileManager.EXTERNAL_FILE, externalFiles[i].getOriginalFilename())); |
| 531 | + fileInfo = new FileInfo(fileManager.getFileFromInputStream(parentFolder, stream, FileManager.EXTERNAL_FILE, externalFiles[i].getOriginalFilename()), null, null, requestDecorator); |
529 | 532 | } |
530 | 533 | } |
531 | 534 | } else if (CONTENT_TYPE_STRING.equals(externalContentType[i])) { |
532 | 535 | if (StringUtils.isNotBlank(externalStrings[i])) { |
533 | | - fileInfo = new FileInfo(fileManager.getFileFromString(parentFolder, externalStrings[i], null, null, artifactType)); |
| 536 | + fileInfo = new FileInfo(fileManager.getFileFromString(parentFolder, externalStrings[i], null, null, artifactType), null, null, requestDecorator); |
534 | 537 | } |
535 | 538 | } else { |
536 | 539 | if (StringUtils.isNotBlank(externalUri[i])) { |
537 | | - fileInfo = fileManager.getFileFromURL(parentFolder, externalUri[i], null, null, null, null, artifactType, null, domainConfig.getHttpVersion()); |
| 540 | + fileInfo = fileManager.getFileFromURL(parentFolder, externalUri[i], null, null, null, null, artifactType, null, domainConfig.getHttpVersion(), requestDecorator); |
538 | 541 | } |
539 | 542 | } |
540 | 543 | if (fileInfo != null) { |
541 | 544 | File rootFile = this.fileManager.unzipFile(parentFolder, fileInfo.getFile()); |
542 | 545 | if (rootFile == null) { |
543 | | - artifacts.add(new FileInfo(fileManager.preprocessFileIfNeeded(domainConfig, validationType, artifactType, fileInfo.getFile(), true), fileInfo.getType(), fileInfo.getSource())); |
| 546 | + artifacts.add(new FileInfo(fileManager.preprocessFileIfNeeded(domainConfig, validationType, artifactType, fileInfo.getFile(), true), fileInfo.getType(), fileInfo.getSource(), requestDecorator)); |
544 | 547 | } else { |
545 | 548 | // ZIP File |
546 | 549 | boolean proceed; |
|
0 commit comments