Class MetaInfConfiguration
- All Implemented Interfaces:
Configuration
Scan META-INF of jars to find:
- tlds
- web-fragment.xml
- resources
- those from the container classpath whose pattern matched the WebInfConfiguration.CONTAINER_JAR_PATTERN
- those from WEB-INF/lib
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractConfiguration
AbstractConfiguration.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final StringIf set, to a list of URLs, these resources are added to the context resource base as a resource collection.static final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(WebAppContext context) Configure WebApp.voidfindAndFilterContainerPaths(WebAppContext context) Find jars and directories that are on the container's classpath and apply an optional filter.voidfindAndFilterWebAppPaths(WebAppContext context) Finds the jars that are either physically or virtually in WEB-INF/lib, and applies an optional filter to their full pathnames.findClassDirs(WebAppContext context) findExtraClasspathDirs(WebAppContext context) Get class dirs from WebAppContext.getExtraClasspath as resourcesfindExtraClasspathJars(WebAppContext context) Get jars from WebAppContext.getExtraClasspath as resourcesfindJars(WebAppContext context) Look for jars that should be treated as if they are in WEB-INF/libprotected ResourcefindWebInfClassesDir(WebAppContext context) GetWEB-INF/classesdirfindWebInfLibJars(WebAppContext context) Look for jars inWEB-INF/libgetAllContainerJars(WebAppContext context) voidpostConfigure(WebAppContext context) Clear down after configuration.voidpreConfigure(WebAppContext context) Set up for configuration.voidscanForFragment(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/web-fragment.xml file in the given directory.voidscanForResources(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/resources dir in the given directory.voidscanForTlds(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Collection<URL>> cache) Discover META-INF/*.tld files in the given directoryprotected voidscanJars(WebAppContext context) voidscanJars(WebAppContext context, Collection<Resource> jars, boolean useCaches) For backwards compatibility.voidscanJars(WebAppContext context, Collection<Resource> jars, boolean useCaches, List<String> scanTypes) Look into the jars to discover info in META-INF.Methods inherited from class AbstractConfiguration
abort, deconfigure, destroy, getDependencies, getDependents, getHiddenClasses, getProtectedClasses, isEnabledByDefaultMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Configuration
getServerClasses, getSystemClasses, isAvailable, replaces
-
Field Details
-
USE_CONTAINER_METAINF_CACHE
- See Also:
-
DEFAULT_USE_CONTAINER_METAINF_CACHE
public static final boolean DEFAULT_USE_CONTAINER_METAINF_CACHE- See Also:
-
CACHED_CONTAINER_TLDS
- See Also:
-
CACHED_CONTAINER_FRAGMENTS
-
CACHED_CONTAINER_RESOURCES
- See Also:
-
METAINF_TLDS
- See Also:
-
METAINF_FRAGMENTS
-
METAINF_RESOURCES
- See Also:
-
CONTAINER_JAR_PATTERN
- See Also:
-
WEBINF_JAR_PATTERN
- See Also:
-
__allScanTypes
-
RESOURCE_DIRS
If set, to a list of URLs, these resources are added to the context resource base as a resource collection.- See Also:
-
-
Constructor Details
-
MetaInfConfiguration
public MetaInfConfiguration()
-
-
Method Details
-
preConfigure
Description copied from interface:ConfigurationSet up for configuration.Typically this step discovers configuration resources. Calls to preConfigure may alter the Configurations configured on the WebAppContext, so long as configurations prior to this configuration are not altered.
- Specified by:
preConfigurein interfaceConfiguration- Overrides:
preConfigurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to pre configure
-
findAndFilterContainerPaths
Find jars and directories that are on the container's classpath and apply an optional filter. The filter is a pattern applied to the full jar or directory names. If there is no pattern, then no jar or dir is considered to match.Those jars that do match will be later examined for META-INF information and annotations.
To find them, examine the ModuleLayers hierarchy and the ClassLoaders hierarchy above the webapp classloader that are URLClassLoaders, and the system property java.class.path.
Any
jar:file:resources found will be mounted in theResourceFactoryof the context.- Parameters:
context- the WebAppContext being deployed- Throws:
Exception
-
findAndFilterWebAppPaths
Finds the jars that are either physically or virtually in WEB-INF/lib, and applies an optional filter to their full pathnames.The filter selects which jars will later be examined for META-INF information and annotations. If there is no pattern, then all jars are considered selected.
- Parameters:
context- the WebAppContext being deployed- Throws:
Exception
-
getAllContainerJars
-
configure
Description copied from interface:ConfigurationConfigure WebApp.Typically this step applies the discovered configuration resources to either the
WebAppContextor the associatedMetaData.- Specified by:
configurein interfaceConfiguration- Overrides:
configurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to configure
-
scanJars
- Throws:
Exception
-
scanJars
public void scanJars(WebAppContext context, Collection<Resource> jars, boolean useCaches) throws Exception For backwards compatibility. This method will always scan for all types of data.- Parameters:
context- the context for the scanjars- the jars to scanuseCaches- if true, the scanned info is cached- Throws:
Exception- if unable to scan the jars
-
scanJars
public void scanJars(WebAppContext context, Collection<Resource> jars, boolean useCaches, List<String> scanTypes) throws Exception Look into the jars to discover info in META-INF. If useCaches == true, then we will cache the info discovered indexed by the jar in which it was discovered: this speeds up subsequent context deployments.- Parameters:
context- the context for the scanjars- the jars resources to scanuseCaches- if true, cache the info discoveredscanTypes- the type of things to look for in the jars- Throws:
Exception- if unable to scan the jars
-
scanForResources
public void scanForResources(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/resources dir in the given directory.- Parameters:
context- the context for the scandir- the target directory to scancache- the resource cache
-
scanForFragment
public void scanForFragment(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/web-fragment.xml file in the given directory.- Parameters:
context- the context for the scandir- the dir to scan for fragmentscache- the resource cache
-
scanForTlds
public void scanForTlds(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Collection<URL>> cache) throws Exception Discover META-INF/*.tld files in the given directory- Parameters:
context- the context for the scandir- the directory resource to scan for .tldscache- the resource cache- Throws:
Exception- if unable to scan for .tlds
-
postConfigure
Description copied from interface:ConfigurationClear down after configuration.- Specified by:
postConfigurein interfaceConfiguration- Overrides:
postConfigurein classAbstractConfiguration- Parameters:
context- The context to configure- Throws:
Exception- if unable to post configure
-
findClassDirs
- Throws:
Exception
-
findJars
Look for jars that should be treated as if they are in WEB-INF/lib- Parameters:
context- the context to find the jars in- Returns:
- the list of jar resources found within context
- Throws:
Exception- if unable to find the jars
-
findWebInfLibJars
-
findExtraClasspathJars
Get jars from WebAppContext.getExtraClasspath as resources- Parameters:
context- the context to find extra classpath jars in- Returns:
- the list of Resources with the extra classpath, or null if not found
-
findWebInfClassesDir
GetWEB-INF/classesdir- Parameters:
context- the context to look for theWEB-INF/classesdirectory- Returns:
- the Resource for the
WEB-INF/classesdirectory - Throws:
Exception- if unable to find theWEB-INF/classesdirectory
-
findExtraClasspathDirs
Get class dirs from WebAppContext.getExtraClasspath as resources- Parameters:
context- the context to look for extra classpaths in- Returns:
- the list of Resources to the extra classpath
-