Search in sources :

Example 1 with EntryFilter

use of org.springframework.boot.loader.archive.Archive.EntryFilter in project spring-boot by spring-projects.

the class PropertiesLauncher method getNestedArchives.

private List<Archive> getNestedArchives(String root) throws Exception {
    if (root.startsWith("/") || this.parent.getUrl().equals(this.home.toURI().toURL())) {
        // If home dir is same as parent archive, no need to add it twice.
        return null;
    }
    Archive parent = this.parent;
    if (root.startsWith("jar:file:") && root.contains("!")) {
        int index = root.indexOf("!");
        String file = root.substring("jar:file:".length(), index);
        parent = new JarFileArchive(new File(file));
        root = root.substring(index + 1, root.length());
        while (root.startsWith("/")) {
            root = root.substring(1);
        }
    }
    EntryFilter filter = new PrefixMatchingArchiveFilter(root);
    return parent.getNestedArchives(filter);
}
Also used : EntryFilter(org.springframework.boot.loader.archive.Archive.EntryFilter) JarFileArchive(org.springframework.boot.loader.archive.JarFileArchive) Archive(org.springframework.boot.loader.archive.Archive) ExplodedArchive(org.springframework.boot.loader.archive.ExplodedArchive) JarFileArchive(org.springframework.boot.loader.archive.JarFileArchive) File(java.io.File)

Aggregations

File (java.io.File)1 Archive (org.springframework.boot.loader.archive.Archive)1 EntryFilter (org.springframework.boot.loader.archive.Archive.EntryFilter)1 ExplodedArchive (org.springframework.boot.loader.archive.ExplodedArchive)1 JarFileArchive (org.springframework.boot.loader.archive.JarFileArchive)1