Class 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.
  • Constructor Details

    • AnnotationConfiguration

      public AnnotationConfiguration()
  • Method Details

    • replaces

      public Class<? extends Configuration> replaces()
      Description copied from interface: Configuration
      Get a class that this class replaces/extends. If this is added to Configurations 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

      protected AnnotationParser createAnnotationParser(int platform)
      This parser scans the bundles using the OSGi APIs instead of assuming a jar.
      Overrides:
      createAnnotationParser in class AnnotationConfiguration
      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 class AnnotationConfiguration
    • 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.
      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 AnnotationConfiguration
      Parameters:
      state - the state for the scan
      parser - 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 state
      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(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 state
      parser - The parser
      webbundle - The current webbundle
      Throws:
      Exception - if unable to parse the web bundle
    • parseWebInfClasses

      public void parseWebInfClasses(AnnotationConfiguration.State state, AnnotationParser parser)
      Description copied from class: AnnotationConfiguration
      Scan classes in WEB-INF/classes.
      Overrides:
      parseWebInfClasses in class AnnotationConfiguration
      Parameters:
      state - the state for the scan
      parser - 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 state
      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(AnnotationConfiguration.State state, AnnotationParser parser, org.osgi.framework.Bundle webbundle, org.osgi.framework.Bundle bundle)