Class AnnotationConfiguration
java.lang.Object
org.eclipse.jetty.ee11.webapp.AbstractConfiguration
org.eclipse.jetty.ee11.annotations.AnnotationConfiguration
- All Implemented Interfaces:
org.eclipse.jetty.ee11.webapp.Configuration
public class AnnotationConfiguration
extends org.eclipse.jetty.ee11.webapp.AbstractConfiguration
Configuration for Annotations
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classParserTaskstatic classServletContainerInitializerComparatorstatic classServletContainerInitializerOrderingprotected static classstatic classSimple class to capture elapsed time of an operation.Nested classes/interfaces inherited from class org.eclipse.jetty.ee11.webapp.AbstractConfiguration
org.eclipse.jetty.ee11.webapp.AbstractConfiguration.Builder -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.eclipse.jetty.ee11.webapp.WebAppContext context) protected org.eclipse.jetty.annotations.AnnotationParsercreateAnnotationParser(int javaPlatform) voidcreateServletContainerInitializerAnnotationHandlers(org.eclipse.jetty.ee11.webapp.WebAppContext context, List<jakarta.servlet.ServletContainerInitializer> scis) getInitializerOrdering(org.eclipse.jetty.ee11.webapp.WebAppContext context) Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.protected org.eclipse.jetty.util.resource.ResourcegetJarFor(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.servlet.ServletContainerInitializer service) protected intgetMaxScanWait(org.eclipse.jetty.ee11.webapp.WebAppContext context) Work out how long we should wait for the async scanning to occur.protected List<jakarta.servlet.ServletContainerInitializer> Get SCIs that are not excluded from considerationbooleanisFromContainerClassPath(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.servlet.ServletContainerInitializer sci) Test if the ServletContainerInitializer is from the container classpathbooleanisFromExcludedJar(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.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.booleanisFromWebInfClasses(org.eclipse.jetty.ee11.webapp.WebAppContext context, org.eclipse.jetty.util.resource.Resource sci) Test if the ServletContainerInitializer is from WEB-INF/classesprotected booleanisUseMultiThreading(org.eclipse.jetty.ee11.webapp.WebAppContext context) Check if we should use multiple threads to scan for annotations or notprotected booleanmatchesExclusionPattern(AnnotationConfiguration.State state, jakarta.servlet.ServletContainerInitializer sci) Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPatternvoidparseContainerPath(org.eclipse.jetty.ee11.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) Scan jars on container path.protected voidparseWebInfClasses(AnnotationConfiguration.State state, org.eclipse.jetty.annotations.AnnotationParser parser) Scan classes in WEB-INF/classes.protected voidparseWebInfLib(AnnotationConfiguration.State state, org.eclipse.jetty.annotations.AnnotationParser parser) Scan jars in WEB-INF/lib.voidpostConfigure(org.eclipse.jetty.ee11.webapp.WebAppContext context) voidpreConfigure(org.eclipse.jetty.ee11.webapp.WebAppContext context) protected voidscanForAnnotations(org.eclipse.jetty.ee11.webapp.WebAppContext context, AnnotationConfiguration.State state) Perform scanning of classes for discoverable annotations such as WebServlet/WebFilter/WebListenerMethods inherited from class org.eclipse.jetty.ee11.webapp.AbstractConfiguration
abort, deconfigure, destroy, getDependencies, getDependents, getHiddenClasses, getProtectedClasses, isEnabledByDefaultMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.ee11.webapp.Configuration
isAvailable, 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:
-
STATE
- 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:
-
-
Constructor Details
-
AnnotationConfiguration
public AnnotationConfiguration()
-
-
Method Details
-
preConfigure
public void preConfigure(org.eclipse.jetty.ee11.webapp.WebAppContext context) - Specified by:
preConfigurein interfaceorg.eclipse.jetty.ee11.webapp.Configuration- Overrides:
preConfigurein classorg.eclipse.jetty.ee11.webapp.AbstractConfiguration
-
configure
-
postConfigure
-
scanForAnnotations
protected void scanForAnnotations(org.eclipse.jetty.ee11.webapp.WebAppContext context, AnnotationConfiguration.State state) throws Exception Perform 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
protected org.eclipse.jetty.annotations.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(org.eclipse.jetty.ee11.webapp.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:
-
getMaxScanWait
protected int getMaxScanWait(org.eclipse.jetty.ee11.webapp.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:
-
createServletContainerInitializerAnnotationHandlers
-
getJarFor
protected org.eclipse.jetty.util.resource.Resource getJarFor(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.servlet.ServletContainerInitializer service) -
isFromExcludedJar
public boolean isFromExcludedJar(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.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. 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
protected boolean matchesExclusionPattern(AnnotationConfiguration.State state, jakarta.servlet.ServletContainerInitializer sci) Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPattern- Parameters:
state- the state of the Annotation parsingsci- the ServletContainerIntializer- Returns:
- true if the ServletContainerIntializer is excluded
-
isFromContainerClassPath
public boolean isFromContainerClassPath(org.eclipse.jetty.ee11.webapp.WebAppContext context, jakarta.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
public boolean isFromWebInfClasses(org.eclipse.jetty.ee11.webapp.WebAppContext context, org.eclipse.jetty.util.resource.Resource sci) 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
protected List<jakarta.servlet.ServletContainerInitializer> getNonExcludedInitializers(AnnotationConfiguration.State state) Get SCIs that are not excluded from consideration- Parameters:
state- the web app annotation parse state- Returns:
- the list of non-excluded servlet container initializers
-
getInitializerOrdering
public AnnotationConfiguration.ServletContainerInitializerOrdering getInitializerOrdering(org.eclipse.jetty.ee11.webapp.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(org.eclipse.jetty.ee11.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) Scan jars on container path.- Parameters:
context- the context for the scanparser- the parser to scan with
-
parseWebInfLib
protected void parseWebInfLib(AnnotationConfiguration.State state, org.eclipse.jetty.annotations.AnnotationParser parser) throws Exception Scan jars in WEB-INF/lib.Only jars selected by MetaInfConfiguration, and that are not excluded by an ordering will be considered.
- Parameters:
state- the state for the scanparser- the annotation parser to use- Throws:
Exception- if unable to scan and/or parse
-
parseWebInfClasses
protected void parseWebInfClasses(AnnotationConfiguration.State state, org.eclipse.jetty.annotations.AnnotationParser parser) Scan classes in WEB-INF/classes.- Parameters:
state- the state for the scanparser- the annotation parser to use
-