Package org.eclipse.jetty.annotations
Class AnnotationConfiguration
java.lang.Object
org.eclipse.jetty.webapp.AbstractConfiguration
org.eclipse.jetty.annotations.AnnotationConfiguration
- All Implemented Interfaces:
- Configuration
- Direct Known Subclasses:
- AnnotationConfiguration
Configuration for Annotations
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic classclassParserTask Task to executing scanning of a resource for annotations.classServletContainerInitializerComparator Comparator impl that orders a set of ServletContainerInitializers according to the list of classnames (optionally containing a "*" wildcard character) established in a ServletContainerInitializerOrdering.classServletContainerInitializerOrderingstatic classSimple class to capture elapsed time of an operation.Nested classes/interfaces inherited from interface org.eclipse.jetty.webapp.ConfigurationConfiguration.Wrapper, Configuration.WrapperFunction
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ClassInheritanceHandlerprotected final List<ContainerInitializerAnnotationHandler>protected CounterStatisticprotected final List<AbstractDiscoverableAnnotationHandler>protected List<AnnotationConfiguration.ParserTask>protected Patternprotected final List<AnnotationConfiguration.DiscoveredServletContainerInitializerHolder>protected CounterStatisticprotected CounterStatisticstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.eclipse.jetty.webapp.ConfigurationATTR
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidvoidcloneConfigure(WebAppContext template, WebAppContext context) voidconfigure(WebAppContext context) Configure WebApp.protected AnnotationParsercreateAnnotationParser(int javaPlatform) voidcreateServletContainerInitializerAnnotationHandlers(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis) getInitializerOrdering(WebAppContext context) Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.getJarFor(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, Resource sciResource) Check to see if the ServletContainerIntializer loaded via the ServiceLoader came from a jar that is excluded by the fragment ordering.booleanisFromWebInfClasses(WebAppContext context, Resource sci) Test if the ServletContainerInitializer is from WEB-INF/classesprotected 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/classes.voidparseWebInfLib(WebAppContext context, AnnotationParser parser) Scan jars in WEB-INF/lib.voidpostConfigure(WebAppContext context) Clear down after configuration.voidpreConfigure(WebAppContext context) Set up for configuration.protected voidscanForAnnotations(WebAppContext context) Perform scanning of classes for discoverable annotations such as WebServlet/WebFilter/WebListenerMethods inherited from class org.eclipse.jetty.webapp.AbstractConfigurationabort, addDependencies, addDependencies, addDependents, addDependents, deconfigure, destroy, expose, getDependencies, getDependents, getServerClasses, getSystemClasses, hide, isEnabledByDefault, protect, protectAndExposeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.webapp.ConfigurationisAvailable, replaces
- 
Field Details- 
SERVLET_CONTAINER_INITIALIZER_EXCLUSION_PATTERN- See Also:
 
- 
SERVLET_CONTAINER_INITIALIZER_ORDER- See Also:
 
- 
CLASS_INHERITANCE_MAP- See Also:
 
- 
CONTAINER_INITIALIZERS- See Also:
 
- 
CONTAINER_INITIALIZER_STARTER- See Also:
 
- 
MULTI_THREADED- See Also:
 
- 
MAX_SCAN_WAIT- See Also:
 
- 
DEFAULT_MAX_SCAN_WAITpublic static final int DEFAULT_MAX_SCAN_WAIT- See Also:
 
- 
DEFAULT_MULTI_THREADEDpublic static final boolean DEFAULT_MULTI_THREADED- See Also:
 
- 
_discoverableAnnotationHandlers
- 
_classInheritanceHandler
- 
_containerInitializerAnnotationHandlers
- 
_sciHoldersprotected final List<AnnotationConfiguration.DiscoveredServletContainerInitializerHolder> _sciHolders
- 
_parserTasks
- 
_containerPathStats
- 
_webInfLibStats
- 
_webInfClassesStats
- 
_sciExcludePattern
 
- 
- 
Constructor Details- 
AnnotationConfigurationpublic AnnotationConfiguration()
 
- 
- 
Method Details- 
preConfigureDescription 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 interface- Configuration
- Overrides:
- preConfigurein class- AbstractConfiguration
- Parameters:
- context- The context to configure
- Throws:
- Exception- if unable to pre configure
 
- 
addDiscoverableAnnotationHandler
- 
configureDescription copied from interface:ConfigurationConfigure WebApp.Typically this step applies the discovered configuration resources to either the WebAppContextor the associatedMetaData.- Specified by:
- configurein interface- Configuration
- Overrides:
- configurein class- AbstractConfiguration
- Parameters:
- context- The context to configure
- Throws:
- Exception- if unable to configure
 
- 
postConfigureDescription copied from interface:ConfigurationClear down after configuration.- Specified by:
- postConfigurein interface- Configuration
- Overrides:
- postConfigurein class- AbstractConfiguration
- Parameters:
- context- The context to configure
- Throws:
- Exception- if unable to post configure
 
- 
scanForAnnotationsPerform scanning of classes for discoverable annotations such as WebServlet/WebFilter/WebListener- Parameters:
- context- the context for the scan
- Throws:
- Exception- if unable to scan
 
- 
createAnnotationParser- 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.
 
- 
isUseMultiThreadingCheck 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:
 
- 
getMaxScanWaitWork 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:
 
- 
cloneConfigure- Overrides:
- cloneConfigurein class- AbstractConfiguration
- Throws:
- Exception
 
- 
createServletContainerInitializerAnnotationHandlerspublic void createServletContainerInitializerAnnotationHandlers(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis) throws Exception - Throws:
- Exception
 
- 
getJarForpublic Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws MalformedURLException, IOException - Throws:
- MalformedURLException
- IOException
 
- 
isFromExcludedJarpublic boolean isFromExcludedJar(WebAppContext context, javax.servlet.ServletContainerInitializer sci, 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 jars
- sci- the servlet container initializer
- sciResource- the resource for the servlet container initializer
- Returns:
- true if excluded
- Throws:
- Exception- if unable to determine exclusion
 
- 
matchesExclusionPatternpublic 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
 
- 
isFromContainerClassPathpublic boolean isFromContainerClassPath(WebAppContext context, javax.servlet.ServletContainerInitializer sci) Test if the ServletContainerInitializer is from the container classpath- Parameters:
- context- the context for the webapp classpath
- sci- the ServletContainerIntializer
- Returns:
- true if ServletContainerIntializer is from container classpath
 
- 
isFromWebInfClassesTest if the ServletContainerInitializer is from WEB-INF/classes- Parameters:
- context- the webapp to test
- sci- a Resource representing the SCI
- Returns:
- true if the sci Resource is inside a WEB-INF/classes directory, false otherwise
 
- 
getNonExcludedInitializerspublic 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
 
- 
getInitializerOrderingpublic 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
 
- 
parseContainerPathScan jars on container path.- Parameters:
- context- the context for the scan
- parser- the parser to scan with
- Throws:
- Exception- if unable to scan
 
- 
parseWebInfLibScan jars in WEB-INF/lib. Only jars selected by MetaInfConfiguration, and that are not excluded by an ordering will be considered.- Parameters:
- context- the context for the scan
- parser- the annotation parser to use
- Throws:
- Exception- if unable to scan and/or parse
 
- 
parseWebInfClassesScan classes in WEB-INF/classes.- Parameters:
- context- the context for the scan
- parser- the annotation parser to use
- Throws:
- Exception- if unable to scan and/or parse
 
 
-