Class AnnotationConfiguration
java.lang.Object
org.eclipse.jetty.ee10.webapp.AbstractConfiguration
org.eclipse.jetty.ee10.annotations.AnnotationConfiguration
org.eclipse.jetty.ee10.osgi.annotations.AnnotationConfiguration
- All Implemented Interfaces:
Configuration
Extend the AnnotationConfiguration to support OSGi:
Look for annotations inside WEB-INF/lib and also in the fragments and required bundles.
Discover them using a scanner adapted to OSGi instead of the jarscanner.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.ee10.annotations.AnnotationConfiguration
AnnotationConfiguration.ClassInheritanceMap, AnnotationConfiguration.DiscoveredServletContainerInitializerHolder, AnnotationConfiguration.ParserTask, AnnotationConfiguration.ServletContainerInitializerComparator, AnnotationConfiguration.ServletContainerInitializerOrdering, AnnotationConfiguration.State, AnnotationConfiguration.TimeStatistic
Nested classes/interfaces inherited from class org.eclipse.jetty.ee10.webapp.AbstractConfiguration
AbstractConfiguration.Builder
-
Field Summary
Fields inherited from class org.eclipse.jetty.ee10.annotations.AnnotationConfiguration
CLASS_INHERITANCE_MAP, CONTAINER_INITIALIZER_STARTER, CONTAINER_INITIALIZERS, DEFAULT_MAX_SCAN_WAIT, DEFAULT_MULTI_THREADED, MAX_SCAN_WAIT, MULTI_THREADED, SERVLET_CONTAINER_INITIALIZER_EXCLUSION_PATTERN, SERVLET_CONTAINER_INITIALIZER_ORDER, STATE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected AnnotationParser
createAnnotationParser
(int platform) This parser scans the bundles using the OSGi APIs instead of assuming a jar.protected Resource
getJarFor
(WebAppContext context, jakarta.servlet.ServletContainerInitializer service) protected void
parseBundle
(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle) protected void
parseFragmentBundle
(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle) Scan a fragment bundle for servlet annotationsprotected void
parseRequiredBundle
(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle) Scan a bundle required by the webbundle for servlet annotationsprotected void
parseWebBundle
(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle) Scan a bundle required by the webbundle for servlet annotationsvoid
parseWebInfClasses
(AnnotationConfiguration.State state, AnnotationParser parser) Scan classes in WEB-INF/classes.void
parseWebInfLib
(AnnotationConfiguration.State state, AnnotationParser parser) Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.Class<? extends Configuration>
replaces()
Get a class that this class replaces/extends.Methods inherited from class org.eclipse.jetty.ee10.annotations.AnnotationConfiguration
configure, createServletContainerInitializerAnnotationHandlers, getInitializerOrdering, getMaxScanWait, getNonExcludedInitializers, isFromContainerClassPath, isFromExcludedJar, isFromWebInfClasses, isUseMultiThreading, matchesExclusionPattern, parseContainerPath, postConfigure, preConfigure, scanForAnnotations
Methods inherited from class org.eclipse.jetty.ee10.webapp.AbstractConfiguration
abort, deconfigure, destroy, getDependencies, getDependents, getHiddenClasses, getProtectedClasses, isEnabledByDefault
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.ee10.webapp.Configuration
getServerClasses, getSystemClasses, isAvailable
-
Constructor Details
-
AnnotationConfiguration
public AnnotationConfiguration()
-
-
Method Details
-
replaces
Description copied from interface:Configuration
Get a class that this class replaces/extends. If this is added toConfigurations
collection that already contains a configuration of the replaced class or that reports to replace the same class, then it is replaced with this instance.- Returns:
- The class this Configuration replaces/extends or null if it replaces no other configuration
-
createAnnotationParser
This parser scans the bundles using the OSGi APIs instead of assuming a jar.- Overrides:
createAnnotationParser
in classAnnotationConfiguration
- Parameters:
platform
- 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.
-
getJarFor
protected Resource getJarFor(WebAppContext context, jakarta.servlet.ServletContainerInitializer service) - Overrides:
getJarFor
in classAnnotationConfiguration
-
parseWebInfLib
public void parseWebInfLib(AnnotationConfiguration.State state, AnnotationParser parser) throws Exception Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.- The container jars are scanned.
- The WEB-INF/classes are scanned
- The osgi fragment to the web bundle are parsed.
- The WEB-INF/lib are scanned
- The required bundles are parsed
- Overrides:
parseWebInfLib
in classAnnotationConfiguration
- Parameters:
state
- the state for the scanparser
- the annotation parser to use- Throws:
Exception
- if unable to scan and/or parse
-
parseFragmentBundle
protected void parseFragmentBundle(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle) throws Exception Scan a fragment bundle for servlet annotations- Parameters:
state
- The webapp context stateparser
- The parserwebbundle
- The current webbundlefragmentBundle
- The OSGi fragment bundle to scan- Throws:
Exception
- if unable to parse fragment bundle
-
parseWebBundle
protected void parseWebBundle(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle) throws Exception Scan a bundle required by the webbundle for servlet annotations- Parameters:
state
- The webapp context stateparser
- The parserwebbundle
- The current webbundle- Throws:
Exception
- if unable to parse the web bundle
-
parseWebInfClasses
Description copied from class:AnnotationConfiguration
Scan classes in WEB-INF/classes.- Overrides:
parseWebInfClasses
in classAnnotationConfiguration
- Parameters:
state
- the state for the scanparser
- the annotation parser to use
-
parseRequiredBundle
protected void parseRequiredBundle(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle) throws Exception Scan a bundle required by the webbundle for servlet annotations- Parameters:
state
- The webapp annotation parse stateparser
- The parserwebbundle
- The current webbundlerequiredBundle
- The OSGi required bundle to scan- Throws:
Exception
- if unable to parse the required bundle
-
parseBundle
protected void parseBundle(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle)
-