Class AnnotationConfiguration
- java.lang.Object
-
- org.eclipse.jetty.webapp.AbstractConfiguration
-
- org.eclipse.jetty.annotations.AnnotationConfiguration
-
- org.eclipse.jetty.osgi.annotations.AnnotationConfiguration
-
- All Implemented Interfaces:
Configuration
public class AnnotationConfiguration extends AnnotationConfiguration
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 Modifier and Type Class Description class
AnnotationConfiguration.BundleParserTask
-
Nested classes/interfaces inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
AnnotationConfiguration.ClassInheritanceMap, AnnotationConfiguration.ParserTask, AnnotationConfiguration.ServletContainerInitializerComparator, AnnotationConfiguration.ServletContainerInitializerOrdering, AnnotationConfiguration.TimeStatistic
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.webapp.Configuration
Configuration.ClassList, Configuration.Wrapper, Configuration.WrapperFunction
-
-
Field Summary
-
Fields inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
_classInheritanceHandler, _containerInitializerAnnotationHandlers, _containerPathStats, _discoverableAnnotationHandlers, _loadedInitializers, _parserTasks, _sciExcludePattern, _webInfClassesStats, _webInfLibStats, 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
-
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 protected AnnotationParser
createAnnotationParser(int javaTargetVersion)
This parser scans the bundles using the OSGi APIs instead of assuming a jar.Resource
getJarFor(javax.servlet.ServletContainerInitializer service)
protected void
parseBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle)
protected void
parseFragmentBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle)
Scan a fragment bundle for servlet annotationsprotected void
parseRequiredBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle)
Scan a bundle required by the webbundle for servlet annotationsprotected void
parseWebBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle)
Scan a bundle required by the webbundle for servlet annotationsvoid
parseWebInfClasses(WebAppContext context, AnnotationParser parser)
Scan classes in WEB-INF/classesvoid
parseWebInfLib(WebAppContext context, AnnotationParser parser)
Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.-
Methods inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
addDiscoverableAnnotationHandler, cloneConfigure, configure, createServletContainerInitializerAnnotationHandlers, getFragmentFromJar, getInitializerOrdering, getMaxScanWait, getNonExcludedInitializers, isFromContainerClassPath, isFromExcludedJar, isFromWebInfClasses, isMetaDataComplete, isUseMultiThreading, matchesExclusionPattern, parseContainerPath, postConfigure, preConfigure, scanForAnnotations
-
Methods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
deconfigure, destroy
-
-
-
-
Method Detail
-
createAnnotationParser
protected AnnotationParser createAnnotationParser(int javaTargetVersion)
This parser scans the bundles using the OSGi APIs instead of assuming a jar.- Overrides:
createAnnotationParser
in classAnnotationConfiguration
- Parameters:
javaTargetVersion
- 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
public Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws java.io.IOException
- Overrides:
getJarFor
in classAnnotationConfiguration
- Throws:
java.io.IOException
-
parseWebInfLib
public void parseWebInfLib(WebAppContext context, AnnotationParser parser) throws java.lang.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:
context
- the context for the scanparser
- the annotation parser to use- Throws:
java.lang.Exception
- if unable to scan and/or parse
-
parseFragmentBundle
protected void parseFragmentBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle) throws java.lang.Exception
Scan a fragment bundle for servlet annotations- Parameters:
context
- The webapp contextparser
- The parserwebbundle
- The current webbundlefragmentBundle
- The OSGi fragment bundle to scan- Throws:
java.lang.Exception
- if unable to parse fragment bundle
-
parseWebBundle
protected void parseWebBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle) throws java.lang.Exception
Scan a bundle required by the webbundle for servlet annotations- Parameters:
context
- The webapp contextparser
- The parserwebbundle
- The current webbundle- Throws:
java.lang.Exception
- if unable to parse the web bundle
-
parseWebInfClasses
public void parseWebInfClasses(WebAppContext context, AnnotationParser parser) throws java.lang.Exception
Description copied from class:AnnotationConfiguration
Scan classes in WEB-INF/classes- Overrides:
parseWebInfClasses
in classAnnotationConfiguration
- Parameters:
context
- the context for the scanparser
- the annotation parser to use- Throws:
java.lang.Exception
- if unable to scan and/or parse- See Also:
AnnotationConfiguration.parseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.annotations.AnnotationParser)
-
parseRequiredBundle
protected void parseRequiredBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle) throws java.lang.Exception
Scan a bundle required by the webbundle for servlet annotations- Parameters:
context
- The webapp contextparser
- The parserwebbundle
- The current webbundlerequiredBundle
- The OSGi required bundle to scan- Throws:
java.lang.Exception
- if unable to parse the required bundle
-
parseBundle
protected void parseBundle(WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-