public class AnnotationConfiguration extends AbstractConfiguration
Modifier and Type | Class and Description |
---|---|
static class |
AnnotationConfiguration.ClassInheritanceMap |
class |
AnnotationConfiguration.ParserTask
ParserTask
Task to executing scanning of a resource for annotations.
|
class |
AnnotationConfiguration.ServletContainerInitializerComparator
ServletContainerInitializerComparator
Comparator impl that orders a set of ServletContainerInitializers according to the
list of classnames (optionally containing a "*" wildcard character) established in a
ServletContainerInitializerOrdering.
|
class |
AnnotationConfiguration.ServletContainerInitializerOrdering
ServletContainerInitializerOrdering
A list of classnames of ServletContainerInitializers in the order in which
they are to be called back.
|
class |
AnnotationConfiguration.TimeStatistic
TimeStatistic
Simple class to capture elapsed time of an operation.
|
Configuration.ClassList
ATTR
Constructor and Description |
---|
AnnotationConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
addDiscoverableAnnotationHandler(AbstractDiscoverableAnnotationHandler handler) |
void |
cloneConfigure(WebAppContext template,
WebAppContext context)
Clone configuration instance.
|
void |
configure(WebAppContext context)
Configure WebApp.
|
protected AnnotationParser |
createAnnotationParser(int javaPlatform) |
void |
createServletContainerInitializerAnnotationHandlers(WebAppContext context,
java.util.List<javax.servlet.ServletContainerInitializer> scis) |
FragmentDescriptor |
getFragmentFromJar(Resource jar,
java.util.List<FragmentDescriptor> frags)
Get the web-fragment.xml from a jar
|
AnnotationConfiguration.ServletContainerInitializerOrdering |
getInitializerOrdering(WebAppContext context)
Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.
|
Resource |
getJarFor(javax.servlet.ServletContainerInitializer service) |
protected int |
getMaxScanWait(WebAppContext context)
Work out how long we should wait for the async scanning to occur.
|
java.util.List<javax.servlet.ServletContainerInitializer> |
getNonExcludedInitializers(WebAppContext context)
Get SCIs that are not excluded from consideration
|
boolean |
isFromContainerClassPath(WebAppContext context,
javax.servlet.ServletContainerInitializer sci)
Test if the ServletContainerInitializer is from the container classpath
|
boolean |
isFromExcludedJar(WebAppContext context,
javax.servlet.ServletContainerInitializer sci,
Resource sciResource)
Check to see if the ServletContainerIntializer loaded via the ServiceLoader came
from a jar that is excluded by the fragment ordering.
|
boolean |
isFromWebInfClasses(WebAppContext context,
Resource sci)
Test if the ServletContainerInitializer is from WEB-INF/classes
|
boolean |
isMetaDataComplete(WebDescriptor d) |
protected boolean |
isUseMultiThreading(WebAppContext context)
Check if we should use multiple threads to scan for annotations or not
|
boolean |
matchesExclusionPattern(javax.servlet.ServletContainerInitializer sci)
Test if the ServletContainerIntializer is excluded by the
o.e.j.containerInitializerExclusionPattern
|
void |
parseContainerPath(WebAppContext context,
AnnotationParser parser)
Scan jars on container path.
|
void |
parseWebInfClasses(WebAppContext context,
AnnotationParser parser)
Scan classes in WEB-INF/classes
|
void |
parseWebInfLib(WebAppContext context,
AnnotationParser parser)
Scan jars in WEB-INF/lib
|
void |
postConfigure(WebAppContext context)
Clear down after configuration.
|
void |
preConfigure(WebAppContext context)
Set up for configuration.
|
protected void |
scanForAnnotations(WebAppContext context)
Perform scanning of classes for annotations
|
deconfigure, destroy
public static final java.lang.String SERVLET_CONTAINER_INITIALIZER_EXCLUSION_PATTERN
public static final java.lang.String SERVLET_CONTAINER_INITIALIZER_ORDER
public static final java.lang.String CLASS_INHERITANCE_MAP
public static final java.lang.String CONTAINER_INITIALIZERS
public static final java.lang.String CONTAINER_INITIALIZER_STARTER
public static final java.lang.String MULTI_THREADED
public static final java.lang.String MAX_SCAN_WAIT
public static final int DEFAULT_MAX_SCAN_WAIT
public static final boolean DEFAULT_MULTI_THREADED
protected final java.util.List<AbstractDiscoverableAnnotationHandler> _discoverableAnnotationHandlers
protected ClassInheritanceHandler _classInheritanceHandler
protected final java.util.List<ContainerInitializerAnnotationHandler> _containerInitializerAnnotationHandlers
protected java.util.List<AnnotationConfiguration.ParserTask> _parserTasks
protected CounterStatistic _containerPathStats
protected CounterStatistic _webInfLibStats
protected CounterStatistic _webInfClassesStats
protected java.util.regex.Pattern _sciExcludePattern
protected java.util.ServiceLoader<javax.servlet.ServletContainerInitializer> _loadedInitializers
public void preConfigure(WebAppContext context) throws java.lang.Exception
Configuration
Typically this step discovers configuration resources
preConfigure
in interface Configuration
preConfigure
in class AbstractConfiguration
context
- The context to configurejava.lang.Exception
- if unable to pre configurepublic void addDiscoverableAnnotationHandler(AbstractDiscoverableAnnotationHandler handler)
public void configure(WebAppContext context) throws java.lang.Exception
Configuration
Typically this step applies the discovered configuration resources to
either the WebAppContext
or the associated MetaData
.
configure
in interface Configuration
configure
in class AbstractConfiguration
context
- The context to configurejava.lang.Exception
- if unable to configureAbstractConfiguration.configure(org.eclipse.jetty.webapp.WebAppContext)
public void postConfigure(WebAppContext context) throws java.lang.Exception
Configuration
postConfigure
in interface Configuration
postConfigure
in class AbstractConfiguration
context
- The context to configurejava.lang.Exception
- if unable to post configureAbstractConfiguration.postConfigure(org.eclipse.jetty.webapp.WebAppContext)
protected void scanForAnnotations(WebAppContext context) throws java.lang.Exception
context
- the context for the scanjava.lang.Exception
- if unable to scanprotected AnnotationParser createAnnotationParser(int javaPlatform)
javaPlatform
- The java platform to scan for.protected boolean isUseMultiThreading(WebAppContext context)
context
- the context of the multi threaded settingMULTI_THREADED
protected int getMaxScanWait(WebAppContext context)
context
- the context of the max scan wait settingMAX_SCAN_WAIT
public void cloneConfigure(WebAppContext template, WebAppContext context) throws java.lang.Exception
Configuration
Configure an instance of a WebAppContext, based on a template WebAppContext that has previously been configured by this Configuration.
cloneConfigure
in interface Configuration
cloneConfigure
in class AbstractConfiguration
template
- The template contextcontext
- The context to configurejava.lang.Exception
- if unable to cloneAbstractConfiguration.cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
public void createServletContainerInitializerAnnotationHandlers(WebAppContext context, java.util.List<javax.servlet.ServletContainerInitializer> scis) throws java.lang.Exception
java.lang.Exception
public Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws java.net.MalformedURLException, java.io.IOException
java.net.MalformedURLException
java.io.IOException
public boolean isFromExcludedJar(WebAppContext context, javax.servlet.ServletContainerInitializer sci, Resource sciResource) throws java.lang.Exception
context
- the context for the jarssci
- the servlet container initializersciResource
- the resource for the servlet container initializerjava.lang.Exception
- if unable to determine exclusionpublic boolean matchesExclusionPattern(javax.servlet.ServletContainerInitializer sci)
sci
- the ServletContainerIntializerpublic boolean isFromContainerClassPath(WebAppContext context, javax.servlet.ServletContainerInitializer sci)
context
- the context for the webapp classpathsci
- the ServletContainerIntializerpublic boolean isFromWebInfClasses(WebAppContext context, Resource sci)
context
- the webapp to testsci
- a Resource representing the SCIpublic java.util.List<javax.servlet.ServletContainerInitializer> getNonExcludedInitializers(WebAppContext context) throws java.lang.Exception
context
- the web app contextjava.lang.Exception
- if unable to get listpublic AnnotationConfiguration.ServletContainerInitializerOrdering getInitializerOrdering(WebAppContext context)
context
- the context for the initializer ordering configurationpublic void parseContainerPath(WebAppContext context, AnnotationParser parser) throws java.lang.Exception
context
- the context for the scanparser
- the parser to scan withjava.lang.Exception
- if unable to scanpublic void parseWebInfLib(WebAppContext context, AnnotationParser parser) throws java.lang.Exception
context
- the context for the scanparser
- the annotation parser to usejava.lang.Exception
- if unable to scan and/or parsepublic void parseWebInfClasses(WebAppContext context, AnnotationParser parser) throws java.lang.Exception
context
- the context for the scanparser
- the annotation parser to usejava.lang.Exception
- if unable to scan and/or parsepublic FragmentDescriptor getFragmentFromJar(Resource jar, java.util.List<FragmentDescriptor> frags) throws java.lang.Exception
jar
- the jar to look in for a fragmentfrags
- the fragments previously foundjava.lang.Exception
- if unable to determine the the fragment containspublic boolean isMetaDataComplete(WebDescriptor d)
Copyright © 1995–2023 Webtide. All rights reserved.