Class MetaInfResourceCache

java.lang.Object
org.apache.myfaces.config.MetaInfResourceCache

public final class MetaInfResourceCache extends Object
Caches, per web application, the names of all classpath resource entries under META-INF/ found in a single scan.

At startup several independent providers each scan META-INF/ for a different suffix (*.faces-config.xml, *.taglib.xml, contracts/.../jakarta.faces.contract.xml). Each scan opens and fully enumerates every jar on the classpath, so doing the walk once and letting the providers filter the shared name set by suffix avoids walking every jar multiple times. Only the few matching names are then resolved to URLs via ClassLoader.getResources(String) (which is what the providers did previously anyway). The cache lives in the ExternalContext application map, so it is scoped to the web application and released on undeploy - no static state.

  • Field Details

  • Method Details

    • getMetaInfEntryNames

      public static Set<String> getMetaInfEntryNames(ExternalContext externalContext)
      Returns the names of all classpath resource entries under META-INF/, scanning the classpath once per web application and caching the result. Callers filter the returned names by suffix and resolve matches via ClassLoader.getResources(String).
    • getClassLoader

      public static ClassLoader getClassLoader()
      The classloader used both to scan and (by the providers) to resolve matches, kept consistent so the cached names line up with what ClassLoader.getResources(String) will return.