Class JarWarResourceSet

    • Constructor Detail

      • JarWarResourceSet

        public JarWarResourceSet​(WebResourceRoot root,
                                 java.lang.String webAppMount,
                                 java.lang.String base,
                                 java.lang.String archivePath,
                                 java.lang.String internalPath)
                          throws java.lang.IllegalArgumentException
        Creates a new WebResourceSet based on a JAR file that is nested inside a WAR.
        Parameters:
        root - The WebResourceRoot this new WebResourceSet will be added to.
        webAppMount - The path within the web application at which this WebResourceSet will be mounted.
        base - The absolute path to the WAR file on the file system in which the JAR is located.
        archivePath - The path within the WAR file where the JAR file is located.
        internalPath - The path within this new WebResourceSet where resources will be served from. E.g. for a resource JAR, this would be "META-INF/resources"
        Throws:
        java.lang.IllegalArgumentException - if the webAppMount or internalPath is not valid (valid paths must start with '/')
    • Method Detail

      • getArchiveEntries

        protected java.util.Map<java.lang.String,​java.util.jar.JarEntry> getArchiveEntries​(boolean single)
        Obtain the map of entries in the archive. May return null in which case AbstractArchiveResourceSet.getArchiveEntry(String) should be used.

        JarWar can't optimise for a single resource so the Map is always returned.

        Specified by:
        getArchiveEntries in class AbstractArchiveResourceSet
        Parameters:
        single - Is this request being make to support a single lookup? If false, a map will always be returned. If true, implementations may use this as a hint in determining the optimum way to respond.
        Returns:
        The archives entries mapped to their names or null if AbstractArchiveResourceSet.getArchiveEntry(String) should be used.
      • openJarFile

        protected java.util.jar.JarFile openJarFile()
                                             throws java.io.IOException

        JarWar needs to generate jarContents for the inner JAR, not the outer WAR.

        Overrides:
        openJarFile in class AbstractArchiveResourceSet
        Throws:
        java.io.IOException
      • processArchivesEntriesForMultiRelease

        protected void processArchivesEntriesForMultiRelease()
      • getArchiveEntry

        protected java.util.jar.JarEntry getArchiveEntry​(java.lang.String pathInArchive)
        Obtain a single entry from the archive. For performance reasons, AbstractArchiveResourceSet.getArchiveEntries(boolean) should always be called first and the archive entry looked up in the map if one is returned. Only if that call returns null should this method be used.

        Should never be called since getArchiveEntries(boolean) always returns a Map.

        Specified by:
        getArchiveEntry in class AbstractArchiveResourceSet
        Parameters:
        pathInArchive - The path in the archive of the entry required
        Returns:
        The specified archive entry or null if it does not exist