Class MetaInfConfiguration
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
OSGiMetaInfConfiguration
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 org.eclipse.jetty.ee10.webapp.AbstractConfiguration
AbstractConfiguration.Builder
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final boolean
static final String
static final String
static final String
static final String
If set, to a list of URLs, these resources are added to the context resource base as a resource collection.static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(WebAppContext context) Configure WebApp.void
findAndFilterContainerPaths
(WebAppContext context) Find jars and directories that are on the container's classpath and apply an optional filter.void
findAndFilterWebAppPaths
(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 Resource
findWebInfClassesDir
(WebAppContext context) GetWEB-INF/classes
dirfindWebInfLibJars
(WebAppContext context) Look for jars inWEB-INF/lib
getAllContainerJars
(WebAppContext context) void
postConfigure
(WebAppContext context) Clear down after configuration.void
preConfigure
(WebAppContext context) Set up for configuration.void
scanForFragment
(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/web-fragment.xml file in the given directory.void
scanForResources
(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache) Scan for META-INF/resources dir in the given directory.void
scanForTlds
(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Collection<URL>> cache) Discover META-INF/*.tld files in the given directoryprotected void
scanJars
(WebAppContext context) void
scanJars
(WebAppContext context, Collection<Resource> jars, boolean useCaches) For backwards compatibility.void
scanJars
(WebAppContext context, Collection<Resource> jars, boolean useCaches, List<String> scanTypes) Look into the jars to discover info in META-INF.Methods inherited from class org.eclipse.jetty.ee10.webapp.AbstractConfiguration
abort, deconfigure, destroy, getDependencies, getDependents, getHiddenClasses, getProtectedClasses, isEnabledByDefault
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.ee10.webapp.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:Configuration
Set 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:
preConfigure
in interfaceConfiguration
- Overrides:
preConfigure
in 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 classloaders in the hierarchy above the webapp classloader that are URLClassLoaders. For jdk-9 we also look at the java.class.path, and the jdk.module.path.
Any
jar:file:
resources found will be mounted in theResourceFactory
of 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:Configuration
Configure WebApp.Typically this step applies the discovered configuration resources to either the
WebAppContext
or the associatedMetaData
.- Specified by:
configure
in interfaceConfiguration
- Overrides:
configure
in 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 ExceptionDiscover 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:Configuration
Clear down after configuration.- Specified by:
postConfigure
in interfaceConfiguration
- Overrides:
postConfigure
in 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
Look for jars inWEB-INF/lib
-
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/classes
dir- Parameters:
context
- the context to look for theWEB-INF/classes
directory- Returns:
- the Resource for the
WEB-INF/classes
directory - Throws:
Exception
- if unable to find theWEB-INF/classes
directory
-
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
-