Class AnnotationConfiguration
java.lang.Object
org.eclipse.jetty.webapp.AbstractConfiguration
org.eclipse.jetty.annotations.AnnotationConfiguration
org.eclipse.jetty.osgi.annotations.AnnotationConfiguration
- All Implemented Interfaces:
org.eclipse.jetty.webapp.Configuration
public class AnnotationConfiguration
extends org.eclipse.jetty.annotations.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 ClassesNested classes/interfaces inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
org.eclipse.jetty.annotations.AnnotationConfiguration.ClassInheritanceMap, org.eclipse.jetty.annotations.AnnotationConfiguration.DiscoveredServletContainerInitializerHolder, org.eclipse.jetty.annotations.AnnotationConfiguration.ParserTask, org.eclipse.jetty.annotations.AnnotationConfiguration.ServletContainerInitializerComparator, org.eclipse.jetty.annotations.AnnotationConfiguration.ServletContainerInitializerOrdering, org.eclipse.jetty.annotations.AnnotationConfiguration.TimeStatisticNested classes/interfaces inherited from interface org.eclipse.jetty.webapp.Configuration
org.eclipse.jetty.webapp.Configuration.Wrapper, org.eclipse.jetty.webapp.Configuration.WrapperFunction -
Field Summary
Fields inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
_classInheritanceHandler, _containerInitializerAnnotationHandlers, _containerPathStats, _discoverableAnnotationHandlers, _parserTasks, _sciExcludePattern, _sciHolders, _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_ORDERFields inherited from interface org.eclipse.jetty.webapp.Configuration
ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.jetty.annotations.AnnotationParsercreateAnnotationParser(int javaTargetVersion) This parser scans the bundles using the OSGi APIs instead of assuming a jar.org.eclipse.jetty.util.resource.ResourcegetJarFor(javax.servlet.ServletContainerInitializer service) protected voidparseBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle) protected voidparseFragmentBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle) Scan a fragment bundle for servlet annotationsprotected voidparseRequiredBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle requiredBundle) Scan a bundle required by the webbundle for servlet annotationsprotected voidparseWebBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle) Scan a bundle required by the webbundle for servlet annotationsvoidparseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) voidparseWebInfLib(org.eclipse.jetty.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) Here is the order in which jars and osgi artifacts are scanned for discoverable annotations.Class<? extends org.eclipse.jetty.webapp.Configuration>replaces()Methods inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration
addDiscoverableAnnotationHandler, cloneConfigure, configure, createServletContainerInitializerAnnotationHandlers, getInitializerOrdering, getMaxScanWait, getNonExcludedInitializers, isFromContainerClassPath, isFromExcludedJar, isFromWebInfClasses, isUseMultiThreading, matchesExclusionPattern, parseContainerPath, postConfigure, preConfigure, scanForAnnotationsMethods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration
abort, addDependencies, addDependencies, addDependents, addDependents, deconfigure, destroy, expose, getDependencies, getDependents, getServerClasses, getSystemClasses, hide, isEnabledByDefault, protect, protectAndExposeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.webapp.Configuration
isAvailable
-
Constructor Details
-
AnnotationConfiguration
public AnnotationConfiguration()
-
-
Method Details
-
replaces
-
createAnnotationParser
protected org.eclipse.jetty.annotations.AnnotationParser createAnnotationParser(int javaTargetVersion) This parser scans the bundles using the OSGi APIs instead of assuming a jar.- Overrides:
createAnnotationParserin classorg.eclipse.jetty.annotations.AnnotationConfiguration
-
getJarFor
public org.eclipse.jetty.util.resource.Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws MalformedURLException, IOException - Overrides:
getJarForin classorg.eclipse.jetty.annotations.AnnotationConfiguration- Throws:
MalformedURLExceptionIOException
-
parseWebInfLib
public void parseWebInfLib(org.eclipse.jetty.webapp.WebAppContext context, org.eclipse.jetty.annotations.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:
parseWebInfLibin classorg.eclipse.jetty.annotations.AnnotationConfiguration- Throws:
Exception
-
parseFragmentBundle
protected void parseFragmentBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle) throws 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:
Exception- if unable to parse fragment bundle
-
parseWebBundle
protected void parseWebBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle) throws Exception Scan a bundle required by the webbundle for servlet annotations- Parameters:
context- The webapp contextparser- The parserwebbundle- The current webbundle- Throws:
Exception- if unable to parse the web bundle
-
parseWebInfClasses
public void parseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) throws Exception - Overrides:
parseWebInfClassesin classorg.eclipse.jetty.annotations.AnnotationConfiguration- Throws:
Exception
-
parseRequiredBundle
protected void parseRequiredBundle(org.eclipse.jetty.webapp.WebAppContext context, 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:
context- The webapp contextparser- The parserwebbundle- The current webbundlerequiredBundle- The OSGi required bundle to scan- Throws:
Exception- if unable to parse the required bundle
-
parseBundle
protected void parseBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle) throws Exception - Throws:
Exception
-