Top Description Fields Constructors Methods
org.eclipse.jetty.ee10.webapp

public Class MetaInfConfiguration

extends AbstractConfiguration
Class Inheritance
Imports
java.io.File, .IOException, java.net.URI, .URL, .URLClassLoader, java.nio.file.Files, .Path, .Paths, java.util.ArrayList, .Arrays, .Collection, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, java.util.concurrent.ConcurrentHashMap, java.util.function.Consumer, java.util.stream.Collectors, .Stream, org.eclipse.jetty.util.FileID, .StringUtil, .URIUtil, .UriPatternPredicate, org.eclipse.jetty.util.resource.MountedPathResource, .Resource, .ResourceCollators, .ResourceFactory, .ResourceUriPatternPredicate, .Resources, org.slf4j.Logger, .LoggerFactory

MetaInfConfiguration

Scan META-INF of jars to find:

The jars which are scanned are:
  1. those from the container classpath whose pattern matched the WebInfConfiguration.CONTAINER_JAR_PATTERN
  2. those from WEB-INF/lib

Field Summary

Modifier and TypeField and Description
public static final List<String>
public static final String
public static final String
public static final String
public static final String
public static final boolean
private static final Logger
public static final String
public static final String
public static final String
public static final String
RESOURCE_DIRS

If set, to a list of URLs, these resources are added to the context resource base as a resource collection.

public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
findAndFilterContainerPaths(final WebAppContext
the WebAppContext being deployed
context
)

Find jars and directories that are on the container's classpath and apply an optional filter.

public void
findAndFilterWebAppPaths(WebAppContext
the WebAppContext being deployed
context
)

Finds the jars that are either physically or virtually in WEB-INF/lib, and applies an optional filter to their full pathnames.

protected List<Resource>
protected List<Resource>

Returns:

the list of Resources to the extra classpath
findExtraClasspathDirs
(WebAppContext
the context to look for extra classpaths in
context
)

Get class dirs from WebAppContext.getExtraClasspath as resources

protected List<Resource>

Returns:

the list of Resources with the extra classpath, or null if not found
findExtraClasspathJars
(WebAppContext
the context to find extra classpath jars in
context
)

Get jars from WebAppContext.getExtraClasspath as resources

protected List<Resource>

Returns:

the list of jar resources found within context
findJars
(WebAppContext
the context to find the jars in
context
)

Look for jars that should be treated as if they are in WEB-INF/lib

protected Resource

Returns:

the Resource for the WEB-INF/classes directory
findWebInfClassesDir
(WebAppContext
the context to look for the WEB-INF/classes directory
context
)

Get WEB-INF/classes dir

protected List<Resource>

Returns:

the list of jars as Resource
findWebInfLibJars
(WebAppContext
the context to find the lib jars in
context
)

Look for jars in WEB-INF/lib

protected List<URI>
private Collection<URL>

Returns:

the collection of tlds as url references
getTlds
(WebAppContext context, Resource
the directory
dir
)

Find all .tld files in the given directory.

private static boolean
private static boolean
isEmptyResource(Resource resourcesDir)

private boolean
public void
public void
public void
scanForFragment(WebAppContext
the context for the scan
context
,
Resource
the dir to scan for fragments
dir
,
ConcurrentHashMap<Resource, Resource>
the resource cache
cache
)

Scan for META-INF/web-fragment.xml file in the given directory.

public void
scanForResources(WebAppContext
the context for the scan
context
,
Resource
the target directory to scan
dir
,
ConcurrentHashMap<Resource, Resource>
the resource cache
cache
)

Scan for META-INF/resources dir in the given directory.

public void
scanForTlds(WebAppContext
the context for the scan
context
,
Resource
the directory resource to scan for .tlds
dir
,
ConcurrentHashMap<Resource, Collection<URL>>
the resource cache
cache
)

Discover META-INF/*.tld files in the given directory

protected void
public void
scanJars(final WebAppContext
the context for the scan
context
,
Collection<Resource>
the jars to scan
jars
,
boolean
if true, the scanned info is cached
useCaches
)

For backwards compatibility.

public void
scanJars(final WebAppContext
the context for the scan
context
,
Collection<Resource>
the jars resources to scan
jars
,
boolean
if true, cache the info discovered
useCaches
,
List<String>
the type of things to look for in the jars
scanTypes
)

Look into the jars to discover info in META-INF.

Inherited from org.eclipse.jetty.ee10.webapp.AbstractConfiguration:
abortdeconfiguredestroygetDependenciesgetDependentsgetServerClassesgetSystemClassesisEnabledByDefault

Field Detail

__allScanTypesback to summary
public static final List<String> __allScanTypes
CACHED_CONTAINER_FRAGMENTSback to summary
public static final String CACHED_CONTAINER_FRAGMENTS
CACHED_CONTAINER_RESOURCESback to summary
public static final String CACHED_CONTAINER_RESOURCES
CACHED_CONTAINER_TLDSback to summary
public static final String CACHED_CONTAINER_TLDS
CONTAINER_JAR_PATTERNback to summary
public static final String CONTAINER_JAR_PATTERN
DEFAULT_USE_CONTAINER_METAINF_CACHEback to summary
public static final boolean DEFAULT_USE_CONTAINER_METAINF_CACHE
LOGback to summary
private static final Logger LOG
METAINF_FRAGMENTSback to summary
public static final String METAINF_FRAGMENTS
METAINF_RESOURCESback to summary
public static final String METAINF_RESOURCES
METAINF_TLDSback to summary
public static final String METAINF_TLDS
RESOURCE_DIRSback to summary
public static final String RESOURCE_DIRS

If set, to a list of URLs, these resources are added to the context resource base as a resource collection.

USE_CONTAINER_METAINF_CACHEback to summary
public static final String USE_CONTAINER_METAINF_CACHE
WEBINF_JAR_PATTERNback to summary
public static final String WEBINF_JAR_PATTERN

Constructor Detail

MetaInfConfigurationback to summary
public MetaInfConfiguration()

Method Detail

configureback to summary
public void configure(WebAppContext context) throws Exception

Overrides org.eclipse.jetty.ee10.webapp.AbstractConfiguration.configure.

Implements org.eclipse.jetty.ee10.webapp.Configuration.configure.

Doc from org.eclipse.jetty.ee10.webapp.Configuration.configure.

Configure WebApp.

Typically this step applies the discovered configuration resources to either the WebAppContext or the associated MetaData.

Parameters
context:WebAppContext

The context to configure

Annotations
@Override
Exceptions
Exception:
if unable to configure
findAndFilterContainerPathsback to summary
public void findAndFilterContainerPaths(final WebAppContext context) throws Exception

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.

Parameters
context:WebAppContext

the WebAppContext being deployed

findAndFilterWebAppPathsback to summary
public void findAndFilterWebAppPaths(WebAppContext context) throws Exception

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:WebAppContext

the WebAppContext being deployed

findClassDirsback to summary
protected List<Resource> findClassDirs(WebAppContext context) throws Exception
findExtraClasspathDirsback to summary
protected List<Resource> findExtraClasspathDirs(WebAppContext context)

Get class dirs from WebAppContext.getExtraClasspath as resources

Parameters
context:WebAppContext

the context to look for extra classpaths in

Returns:List<Resource>

the list of Resources to the extra classpath

findExtraClasspathJarsback to summary
protected List<Resource> findExtraClasspathJars(WebAppContext context)

Get jars from WebAppContext.getExtraClasspath as resources

Parameters
context:WebAppContext

the context to find extra classpath jars in

Returns:List<Resource>

the list of Resources with the extra classpath, or null if not found

findJarsback to summary
protected List<Resource> findJars(WebAppContext context) throws Exception

Look for jars that should be treated as if they are in WEB-INF/lib

Parameters
context:WebAppContext

the context to find the jars in

Returns:List<Resource>

the list of jar resources found within context

Exceptions
Exception:
if unable to find the jars
findWebInfClassesDirback to summary
protected Resource findWebInfClassesDir(WebAppContext context) throws Exception

Get WEB-INF/classes dir

Parameters
context:WebAppContext

the context to look for the WEB-INF/classes directory

Returns:Resource

the Resource for the WEB-INF/classes directory

Exceptions
Exception:
if unable to find the WEB-INF/classes directory
findWebInfLibJarsback to summary
protected List<Resource> findWebInfLibJars(WebAppContext context) throws Exception

Look for jars in WEB-INF/lib

Parameters
context:WebAppContext

the context to find the lib jars in

Returns:List<Resource>

the list of jars as Resource

Exceptions
Exception:
if unable to scan for lib jars
getAllContainerJarsback to summary
protected List<URI> getAllContainerJars(final WebAppContext context)
getTldsback to summary
private Collection<URL> getTlds(WebAppContext context, Resource dir) throws IOException

Find all .tld files in the given directory.

Parameters
dir:Resource

the directory

Returns:Collection<URL>

the collection of tlds as url references

Exceptions
IOException:
if unable to scan the jar file
isEmptyFragmentback to summary
private static boolean isEmptyFragment(Resource webFrag)
isEmptyResourceback to summary
private static boolean isEmptyResource(Resource resourcesDir)
isFileSupportedback to summary
private boolean isFileSupported(Resource resource)
postConfigureback to summary
public void postConfigure(WebAppContext context) throws Exception

Overrides org.eclipse.jetty.ee10.webapp.AbstractConfiguration.postConfigure.

Implements org.eclipse.jetty.ee10.webapp.Configuration.postConfigure.

Doc from org.eclipse.jetty.ee10.webapp.Configuration.postConfigure.

Clear down after configuration.

Parameters
context:WebAppContext

The context to configure

Annotations
@Override
Exceptions
Exception:
if unable to post configure
preConfigureback to summary
public void preConfigure(final WebAppContext context) throws Exception

Overrides org.eclipse.jetty.ee10.webapp.AbstractConfiguration.preConfigure.

Implements org.eclipse.jetty.ee10.webapp.Configuration.preConfigure.

Doc from org.eclipse.jetty.ee10.webapp.Configuration.preConfigure.

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.

Parameters
context:WebAppContext

The context to configure

Annotations
@Override
Exceptions
Exception:
if unable to pre configure
scanForFragmentback to summary
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:WebAppContext

the context for the scan

dir:Resource

the dir to scan for fragments

cache:ConcurrentHashMap<Resource, Resource>

the resource cache

scanForResourcesback to summary
public void scanForResources(WebAppContext context, Resource dir, ConcurrentHashMap<Resource, Resource> cache)

Scan for META-INF/resources dir in the given directory.

Parameters
context:WebAppContext

the context for the scan

dir:Resource

the target directory to scan

cache:ConcurrentHashMap<Resource, Resource>

the resource cache

scanForTldsback to summary
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:WebAppContext

the context for the scan

dir:Resource

the directory resource to scan for .tlds

cache:ConcurrentHashMap<Resource, Collection<URL>>

the resource cache

Exceptions
Exception:
if unable to scan for .tlds
scanJarsback to summary
protected void scanJars(WebAppContext context) throws Exception
scanJarsback to summary
public void scanJars(final WebAppContext context, Collection<Resource> jars, boolean useCaches) throws Exception

For backwards compatibility. This method will always scan for all types of data.

Parameters
context:WebAppContext

the context for the scan

jars:Collection<Resource>

the jars to scan

useCaches:boolean

if true, the scanned info is cached

Exceptions
Exception:
if unable to scan the jars
scanJarsback to summary
public void scanJars(final 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:WebAppContext

the context for the scan

jars:Collection<Resource>

the jars resources to scan

useCaches:boolean

if true, cache the info discovered

scanTypes:List<String>

the type of things to look for in the jars

Annotations
@SuppressWarnings:unchecked
Exceptions
Exception:
if unable to scan the jars