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 Classes
    Modifier and Type
    Class
    Description
    class 
     

    Nested 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.TimeStatistic

    Nested 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_ORDER

    Fields inherited from interface org.eclipse.jetty.webapp.Configuration

    ATTR
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.eclipse.jetty.annotations.AnnotationParser
    createAnnotationParser(int javaTargetVersion)
    This parser scans the bundles using the OSGi APIs instead of assuming a jar.
    org.eclipse.jetty.util.resource.Resource
    getJarFor(javax.servlet.ServletContainerInitializer service)
     
    protected void
    parseBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle)
     
    protected void
    parseFragmentBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle fragmentBundle)
    Scan a fragment bundle for servlet annotations
    protected void
    parseRequiredBundle(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 annotations
    protected void
    parseWebBundle(org.eclipse.jetty.webapp.WebAppContext context, AnnotationParser parser, org.osgi.framework.Bundle webbundle)
    Scan a bundle required by the webbundle for servlet annotations
    void
    parseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser)
     
    void
    parseWebInfLib(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>
     

    Methods inherited from class org.eclipse.jetty.annotations.AnnotationConfiguration

    addDiscoverableAnnotationHandler, cloneConfigure, configure, createServletContainerInitializerAnnotationHandlers, getInitializerOrdering, getMaxScanWait, getNonExcludedInitializers, isFromContainerClassPath, isFromExcludedJar, isFromWebInfClasses, isUseMultiThreading, matchesExclusionPattern, parseContainerPath, postConfigure, preConfigure, scanForAnnotations

    Methods inherited from class org.eclipse.jetty.webapp.AbstractConfiguration

    abort, addDependencies, addDependencies, addDependents, addDependents, deconfigure, destroy, expose, getDependencies, getDependents, getServerClasses, getSystemClasses, hide, isEnabledByDefault, protect, protectAndExpose

    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.webapp.Configuration

    isAvailable
  • Constructor Details

    • AnnotationConfiguration

      public AnnotationConfiguration()
  • Method Details

    • replaces

      public Class<? extends org.eclipse.jetty.webapp.Configuration> 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:
      createAnnotationParser in class org.eclipse.jetty.annotations.AnnotationConfiguration
    • getJarFor

      public org.eclipse.jetty.util.resource.Resource getJarFor(javax.servlet.ServletContainerInitializer service) throws MalformedURLException, IOException
      Overrides:
      getJarFor in class org.eclipse.jetty.annotations.AnnotationConfiguration
      Throws:
      MalformedURLException
      IOException
    • 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.
      1. The container jars are scanned.
      2. The WEB-INF/classes are scanned
      3. The osgi fragment to the web bundle are parsed.
      4. The WEB-INF/lib are scanned
      5. The required bundles are parsed
      Overrides:
      parseWebInfLib in class org.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 context
      parser - The parser
      webbundle - The current webbundle
      fragmentBundle - 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 context
      parser - The parser
      webbundle - 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:
      parseWebInfClasses in class org.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 context
      parser - The parser
      webbundle - The current webbundle
      requiredBundle - 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