Class JarContents

java.lang.Object
org.apache.catalina.webresources.JarContents

public final class JarContents extends Object
This class represents the contents of a jar by determining whether a given resource might be in the cache, based on a bloom filter. This is not a general-purpose bloom filter because it contains logic to strip out characters from the beginning of the key. The hash methods are simple but good enough for this purpose.
  • Constructor Details

    • JarContents

      public JarContents(JarFile jar)
      Parses the passed-in jar and populates the bit array.
      Parameters:
      jar - the JAR file
    • JarContents

      public JarContents(Collection<JarEntry> entries)
      Populates the bit array from the provided set of JAR entries.
      Parameters:
      entries - The set of entries for the JAR file being processed
  • Method Details

    • mightContainResource

      public boolean mightContainResource(String path, String webappRoot)
      Method that identifies whether a given path MIGHT be in this jar. Uses the Bloom filter mechanism.
      Parameters:
      path - Requested path, including any internal path of the resource set.
      webappRoot - The web application mount point of the resource set, which can be stripped from the path.
      Returns:
      Whether the prefix of the path is known to be in this jar.