Package org.eclipse.jetty.annotations
Class AnnotationConfiguration
- java.lang.Object
-
- org.eclipse.jetty.webapp.AbstractConfiguration
-
- org.eclipse.jetty.annotations.AnnotationConfiguration
-
- All Implemented Interfaces:
Configuration
public class AnnotationConfiguration extends AbstractConfiguration
Configuration for Annotations
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotationConfiguration.ClassInheritanceMapclassAnnotationConfiguration.ContainerClassNameResolverContainerClassNameResolver Checks to see if a classname belongs to a hidden or visible package when scanning for annotations and thus whether it should be excluded from consideration or not.classAnnotationConfiguration.ParserTaskParserTask Task to executing scanning of a resource for annotations.classAnnotationConfiguration.ServletContainerInitializerComparatorServletContainerInitializerComparator Comparator impl that orders a set of ServletContainerInitializers according to the list of classnames (optionally containing a "*" wildcard character) established in a ServletContainerInitializerOrdering.classAnnotationConfiguration.ServletContainerInitializerOrderingServletContainerInitializerOrdering A list of classnames of ServletContainerInitializers in the order in which they are to be called back.classAnnotationConfiguration.TimeStatisticTimeStatistic Simple class to capture elapsed time of an operation.classAnnotationConfiguration.WebAppClassNameResolverWebAppClassNameResolver Checks to see if a classname belongs to hidden or visible packages when scanning, and whether a classname that is a duplicate should override a previously scanned classname.-
Nested classes/interfaces inherited from interface org.eclipse.jetty.webapp.Configuration
Configuration.ClassList
-
-
Field Summary
-
Fields inherited from interface org.eclipse.jetty.webapp.Configuration
ATTR
-
-
Constructor Summary
Constructors Constructor Description AnnotationConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDiscoverableAnnotationHandler(AbstractDiscoverableAnnotationHandler handler)voidcloneConfigure(WebAppContext template, WebAppContext context)voidconfigure(WebAppContext context)protected AnnotationParsercreateAnnotationParser(int javaPlatform)voidcreateServletContainerInitializerAnnotationHandlers(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis)voiddeconfigure(WebAppContext context)FragmentDescriptorgetFragmentFromJar(org.eclipse.jetty.util.resource.Resource jar, List<FragmentDescriptor> frags)Get the web-fragment.xml from a jarAnnotationConfiguration.ServletContainerInitializerOrderinggetInitializerOrdering(WebAppContext context)Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.org.eclipse.jetty.util.resource.ResourcegetJarFor(javax.servlet.ServletContainerInitializer service)protected intgetMaxScanWait(WebAppContext context)Work out how long we should wait for the async scanning to occur.List<javax.servlet.ServletContainerInitializer>getNonExcludedInitializers(WebAppContext context)Get SCIs that are not excluded from considerationbooleanisFromContainerClassPath(WebAppContext context, javax.servlet.ServletContainerInitializer sci)Test if the ServletContainerInitializer is from the container classpathbooleanisFromExcludedJar(WebAppContext context, javax.servlet.ServletContainerInitializer sci, org.eclipse.jetty.util.resource.Resource sciResource)Check to see if the ServletContainerIntializer loaded via the ServiceLoader came from a jar that is excluded by the fragment ordering.booleanisMetaDataComplete(WebDescriptor d)protected booleanisUseMultiThreading(WebAppContext context)Check if we should use multiple threads to scan for annotations or notbooleanmatchesExclusionPattern(javax.servlet.ServletContainerInitializer sci)Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPatternvoidparseContainerPath(WebAppContext context, AnnotationParser parser)Scan jars on container path.voidparseWebInfClasses(WebAppContext context, AnnotationParser parser)Scan classes in WEB-INF/classesvoidparseWebInfLib(WebAppContext context, AnnotationParser parser)Scan jars in WEB-INF/libvoidpostConfigure(WebAppContext context)voidpreConfigure(WebAppContext context)protected voidscanForAnnotations(WebAppContext context)Perform scanning of classes for annotations-
Methods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
destroy
-
-
-
-
Field Detail
-
SERVLET_CONTAINER_INITIALIZER_EXCLUSION_PATTERN
public static final String SERVLET_CONTAINER_INITIALIZER_EXCLUSION_PATTERN
- See Also:
- Constant Field Values
-
SERVLET_CONTAINER_INITIALIZER_ORDER
public static final String SERVLET_CONTAINER_INITIALIZER_ORDER
- See Also:
- Constant Field Values
-
CLASS_INHERITANCE_MAP
public static final String CLASS_INHERITANCE_MAP
- See Also:
- Constant Field Values
-
CONTAINER_INITIALIZERS
public static final String CONTAINER_INITIALIZERS
- See Also:
- Constant Field Values
-
CONTAINER_INITIALIZER_STARTER
public static final String CONTAINER_INITIALIZER_STARTER
- See Also:
- Constant Field Values
-
MULTI_THREADED
public static final String MULTI_THREADED
- See Also:
- Constant Field Values
-
MAX_SCAN_WAIT
public static final String MAX_SCAN_WAIT
- See Also:
- Constant Field Values
-
DEFAULT_MAX_SCAN_WAIT
public static final int DEFAULT_MAX_SCAN_WAIT
- See Also:
- Constant Field Values
-
DEFAULT_MULTI_THREADED
public static final boolean DEFAULT_MULTI_THREADED
- See Also:
- Constant Field Values
-
_discoverableAnnotationHandlers
protected List<AbstractDiscoverableAnnotationHandler> _discoverableAnnotationHandlers
-
_classInheritanceHandler
protected ClassInheritanceHandler _classInheritanceHandler
-
_containerInitializerAnnotationHandlers
protected List<ContainerInitializerAnnotationHandler> _containerInitializerAnnotationHandlers
-
_parserTasks
protected List<AnnotationConfiguration.ParserTask> _parserTasks
-
_webAppClassNameResolver
protected AnnotationConfiguration.WebAppClassNameResolver _webAppClassNameResolver
-
_containerClassNameResolver
protected AnnotationConfiguration.ContainerClassNameResolver _containerClassNameResolver
-
_containerPathStats
protected org.eclipse.jetty.util.statistic.CounterStatistic _containerPathStats
-
_webInfLibStats
protected org.eclipse.jetty.util.statistic.CounterStatistic _webInfLibStats
-
_webInfClassesStats
protected org.eclipse.jetty.util.statistic.CounterStatistic _webInfClassesStats
-
_sciExcludePattern
protected Pattern _sciExcludePattern
-
_loadedInitializers
protected ServiceLoader<javax.servlet.ServletContainerInitializer> _loadedInitializers
-
-
Method Detail
-
preConfigure
public void preConfigure(WebAppContext context) throws Exception
- Specified by:
preConfigurein interfaceConfiguration- Overrides:
preConfigurein classAbstractConfiguration- Throws:
Exception
-
addDiscoverableAnnotationHandler
public void addDiscoverableAnnotationHandler(AbstractDiscoverableAnnotationHandler handler)
-
deconfigure
public void deconfigure(WebAppContext context) throws Exception
- Specified by:
deconfigurein interfaceConfiguration- Overrides:
deconfigurein classAbstractConfiguration- Throws:
Exception
-
configure
public void configure(WebAppContext context) throws Exception
- Specified by:
configurein interfaceConfiguration- Overrides:
configurein classAbstractConfiguration- Throws:
Exception- See Also:
AbstractConfiguration.configure(org.eclipse.jetty.webapp.WebAppContext)
-
postConfigure
public void postConfigure(WebAppContext context) throws Exception
- Specified by:
postConfigurein interfaceConfiguration- Overrides:
postConfigurein classAbstractConfiguration- Throws:
Exception- See Also:
AbstractConfiguration.postConfigure(org.eclipse.jetty.webapp.WebAppContext)
-
scanForAnnotations
protected void scanForAnnotations(WebAppContext context) throws Exception
Perform scanning of classes for annotations- Parameters:
context- the context for the scan- Throws:
Exception- if unable to scan
-
createAnnotationParser
protected AnnotationParser createAnnotationParser(int javaPlatform)
- Parameters:
javaPlatform- The java platform to scan for.- Returns:
- a new AnnotationParser. This method can be overridden to use a different implementation of the AnnotationParser. Note that this is considered internal API.
-
isUseMultiThreading
protected boolean isUseMultiThreading(WebAppContext context)
Check if we should use multiple threads to scan for annotations or not- Parameters:
context- the context of the multi threaded setting- Returns:
- true if multi threading is enabled on the context, server, or via a System property.
- See Also:
MULTI_THREADED
-
getMaxScanWait
protected int getMaxScanWait(WebAppContext context)
Work out how long we should wait for the async scanning to occur.- Parameters:
context- the context of the max scan wait setting- Returns:
- the max scan wait setting on the context, or server, or via a System property.
- See Also:
MAX_SCAN_WAIT
-
cloneConfigure
public void cloneConfigure(WebAppContext template, WebAppContext context) throws Exception
- Specified by:
cloneConfigurein interfaceConfiguration- Overrides:
cloneConfigurein classAbstractConfiguration- Throws:
Exception- See Also:
AbstractConfiguration.cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
-
createServletContainerInitializerAnnotationHandlers
public void createServletContainerInitializerAnnotationHandlers(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis) throws Exception
- Throws:
Exception
-
getJarFor
public org.eclipse.jetty.util.resource.Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws MalformedURLException, IOException- Throws:
MalformedURLExceptionIOException
-
isFromExcludedJar
public boolean isFromExcludedJar(WebAppContext context, javax.servlet.ServletContainerInitializer sci, org.eclipse.jetty.util.resource.Resource sciResource) throws Exception
Check to see if the ServletContainerIntializer loaded via the ServiceLoader came from a jar that is excluded by the fragment ordering. See ServletSpec 3.0 p.85.- Parameters:
context- the context for the jarssci- the servlet container initializersciResource- the resource for the servlet container initializer- Returns:
- true if excluded
- Throws:
Exception- if unable to determine exclusion
-
matchesExclusionPattern
public boolean matchesExclusionPattern(javax.servlet.ServletContainerInitializer sci)
Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPattern- Parameters:
sci- the ServletContainerIntializer- Returns:
- true if the ServletContainerIntializer is excluded
-
isFromContainerClassPath
public boolean isFromContainerClassPath(WebAppContext context, javax.servlet.ServletContainerInitializer sci)
Test if the ServletContainerInitializer is from the container classpath- Parameters:
context- the context for the webapp classpathsci- the ServletContainerIntializer- Returns:
- true if ServletContainerIntializer is from container classpath
-
getNonExcludedInitializers
public List<javax.servlet.ServletContainerInitializer> getNonExcludedInitializers(WebAppContext context) throws Exception
Get SCIs that are not excluded from consideration- Parameters:
context- the web app context- Returns:
- the list of non-excluded servlet container initializers
- Throws:
Exception- if unable to get list
-
getInitializerOrdering
public AnnotationConfiguration.ServletContainerInitializerOrdering getInitializerOrdering(WebAppContext context)
Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.- Parameters:
context- the context for the initializer ordering configuration- Returns:
- the ordering of the ServletContainerIntializer's
-
parseContainerPath
public void parseContainerPath(WebAppContext context, AnnotationParser parser) throws Exception
Scan jars on container path.- Parameters:
context- the context for the scanparser- the parser to scan with- Throws:
Exception- if unable to scan
-
parseWebInfLib
public void parseWebInfLib(WebAppContext context, AnnotationParser parser) throws Exception
Scan jars in WEB-INF/lib- Parameters:
context- the context for the scanparser- the annotation parser to use- Throws:
Exception- if unable to scan and/or parse
-
parseWebInfClasses
public void parseWebInfClasses(WebAppContext context, AnnotationParser parser) throws Exception
Scan classes in WEB-INF/classes- Parameters:
context- the context for the scanparser- the annotation parser to use- Throws:
Exception- if unable to scan and/or parse
-
getFragmentFromJar
public FragmentDescriptor getFragmentFromJar(org.eclipse.jetty.util.resource.Resource jar, List<FragmentDescriptor> frags) throws Exception
Get the web-fragment.xml from a jar- Parameters:
jar- the jar to look in for a fragmentfrags- the fragments previously found- Returns:
- true if the fragment if found, or null of not found
- Throws:
Exception- if unable to determine the the fragment contains
-
isMetaDataComplete
public boolean isMetaDataComplete(WebDescriptor d)
-
-