JarContents (Apache Tomcat 9.0.68 API Documentation)

Package org.apache.catalina.webresources

## Class JarContents

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

-     public final class JarContents
      extends java.lang.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 Summary

    Constructors
    Constructor | Description
    --- | ---
    `JarContents​(java.util.jar.JarFile jar)` | Parses the passed-in jar and populates the bit array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `mightContainResource​(java.lang.String path, java.lang.String webappRoot)` | Method that identifies whether a given path MIGHT be in this jar.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JarContents

          public JarContents​(java.util.jar.JarFile jar)

      Parses the passed-in jar and populates the bit array.
      Parameters:
        `jar` - the JAR file

  - ### Method Detail

    - #### mightContainResource

          public final boolean mightContainResource​(java.lang.String path,
                                                    java.lang.String webappRoot)

      Method that identifies whether a given path MIGHT be in this jar. Uses the Bloom filter mechanism.
      Parameters:
        `path` - Requested path. Sometimes starts with "/WEB-INF/classes".
        `webappRoot` - The value of the webapp location, which can be stripped from the path. Typically is "/WEB-INF/classes".
      Returns:
        Whether the prefix of the path is known to be in this jar.