Package org.eclipse.jetty.annotations
Class AnnotationConfiguration
java.lang.Object
org.eclipse.jetty.webapp.AbstractConfiguration
org.eclipse.jetty.annotations.AnnotationConfiguration
- All Implemented Interfaces:
Configuration
Configuration for Annotations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
class
ParserTask Task to executing scanning of a resource for annotations.class
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
ServletContainerInitializerOrderingclass
TimeStatistic Simple class to capture elapsed time of an operation.Nested classes/interfaces inherited from interface org.eclipse.jetty.webapp.Configuration
Configuration.ClassList, Configuration.Wrapper, Configuration.WrapperFunction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassInheritanceHandler
protected final List
<ContainerInitializerAnnotationHandler> protected CounterStatistic
protected final List
<AbstractDiscoverableAnnotationHandler> protected ServiceLoader
<javax.servlet.ServletContainerInitializer> protected List
<AnnotationConfiguration.ParserTask> protected Pattern
protected CounterStatistic
protected CounterStatistic
static final String
static final String
static final String
static final int
static final boolean
private static final Logger
static final String
static final String
static final String
static final String
Fields inherited from interface org.eclipse.jetty.webapp.Configuration
ATTR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
cloneConfigure
(WebAppContext template, WebAppContext context) Clone configuration instance.void
configure
(WebAppContext context) Configure WebApp.protected AnnotationParser
createAnnotationParser
(int javaPlatform) void
createServletContainerInitializerAnnotationHandlers
(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis) getFragmentFromJar
(Resource jar, List<FragmentDescriptor> frags) Get the web-fragment.xml from a jargetInitializerOrdering
(WebAppContext context) Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.getJarFor
(javax.servlet.ServletContainerInitializer service) protected int
getMaxScanWait
(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 considerationboolean
isFromContainerClassPath
(WebAppContext context, javax.servlet.ServletContainerInitializer sci) Test if the ServletContainerInitializer is from the container classpathboolean
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/classesboolean
protected boolean
isUseMultiThreading
(WebAppContext context) Check if we should use multiple threads to scan for annotations or notboolean
matchesExclusionPattern
(javax.servlet.ServletContainerInitializer sci) Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPatternvoid
parseContainerPath
(WebAppContext context, AnnotationParser parser) Scan jars on container path.void
parseWebInfClasses
(WebAppContext context, AnnotationParser parser) Scan classes in WEB-INF/classesvoid
parseWebInfLib
(WebAppContext context, AnnotationParser parser) Scan jars in WEB-INF/libvoid
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 annotationsMethods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
deconfigure, destroy
-
Field Details
-
LOG
-
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_WAIT
public static final int DEFAULT_MAX_SCAN_WAIT- See Also:
-
DEFAULT_MULTI_THREADED
public static final boolean DEFAULT_MULTI_THREADED- See Also:
-
_discoverableAnnotationHandlers
-
_classInheritanceHandler
-
_containerInitializerAnnotationHandlers
-
_parserTasks
-
_containerPathStats
-
_webInfLibStats
-
_webInfClassesStats
-
_sciExcludePattern
-
_loadedInitializers
-
-
Constructor Details
-
AnnotationConfiguration
public AnnotationConfiguration()
-
-
Method Details
-
preConfigure
Description copied from interface:Configuration
Set up for configuration.Typically this step discovers configuration resources
- Specified by:
preConfigure
in interfaceConfiguration
- Overrides:
preConfigure
in classAbstractConfiguration
- Parameters:
context
- The context to configure- Throws:
Exception
- if unable to pre configure
-
addDiscoverableAnnotationHandler
-
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- See Also:
-
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- See Also:
-
scanForAnnotations
Perform scanning of classes for annotations- 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.
-
isUseMultiThreading
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:
-
getMaxScanWait
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:
-
cloneConfigure
Description copied from interface:Configuration
Clone configuration instance.Configure an instance of a WebAppContext, based on a template WebAppContext that has previously been configured by this Configuration.
- Specified by:
cloneConfigure
in interfaceConfiguration
- Overrides:
cloneConfigure
in classAbstractConfiguration
- Parameters:
template
- The template contextcontext
- The context to configure- Throws:
Exception
- if unable to clone- See Also:
-
createServletContainerInitializerAnnotationHandlers
public void createServletContainerInitializerAnnotationHandlers(WebAppContext context, List<javax.servlet.ServletContainerInitializer> scis) -
getJarFor
- Throws:
IOException
-
isFromExcludedJar
public 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. 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
-
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
-
isFromWebInfClasses
Test if the ServletContainerInitializer is from WEB-INF/classes- Parameters:
context
- the webapp to testsci
- a Resource representing the SCI- Returns:
- true if the sci Resource is inside a WEB-INF/classes directory, false otherwise
-
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
Scan jars on container path.- Parameters:
context
- the context for the scanparser
- the parser to scan with- Throws:
Exception
- if unable to scan
-
parseWebInfLib
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
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(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
-