Class AnnotationConfiguration

    • Constructor Detail

      • AnnotationConfiguration

        public AnnotationConfiguration()
    • Method Detail

      • preConfigure

        public void preConfigure​(WebAppContext context)
                          throws java.lang.Exception
        Description copied from interface: Configuration
        Set up for configuration.

        Typically this step discovers configuration resources

        Specified by:
        preConfigure in interface Configuration
        Overrides:
        preConfigure in class AbstractConfiguration
        Parameters:
        context - The context to configure
        Throws:
        java.lang.Exception - if unable to pre configure
      • scanForAnnotations

        protected void scanForAnnotations​(WebAppContext context)
                                   throws java.lang.Exception
        Perform scanning of classes for annotations
        Parameters:
        context - the context for the scan
        Throws:
        java.lang.Exception - if unable to scan
      • createAnnotationParser

        protected AnnotationParser createAnnotationParser​(int javaPlatform)
        Parameters:
        javaPlatform - 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.
      • isUseMultiThreading

        protected boolean isUseMultiThreading​(WebAppContext context)
        Check if we should use multiple threads to scan for annotations or not
        Parameters:
        context - the context of the multi threaded setting
        Returns:
        true if multi threading is enabled on the context, server, or via a System property.
        See Also:
        MULTI_THREADED
      • getMaxScanWait

        protected int getMaxScanWait​(WebAppContext context)
        Work out how long we should wait for the async scanning to occur.
        Parameters:
        context - the context of the max scan wait setting
        Returns:
        the max scan wait setting on the context, or server, or via a System property.
        See Also:
        MAX_SCAN_WAIT
      • createServletContainerInitializerAnnotationHandlers

        public void createServletContainerInitializerAnnotationHandlers​(WebAppContext context,
                                                                        java.util.List<javax.servlet.ServletContainerInitializer> scis)
      • getJarFor

        public Resource getJarFor​(javax.servlet.ServletContainerInitializer service)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • isFromExcludedJar

        public boolean isFromExcludedJar​(WebAppContext context,
                                         javax.servlet.ServletContainerInitializer sci,
                                         Resource sciResource)
        Check to see if the ServletContainerIntializer loaded via the ServiceLoader came from a jar that is excluded by the fragment ordering. See ServletSpec 3.0 p.85.
        Parameters:
        context - the context for the jars
        sci - the servlet container initializer
        sciResource - the resource for the servlet container initializer
        Returns:
        true if excluded
      • matchesExclusionPattern

        public boolean matchesExclusionPattern​(javax.servlet.ServletContainerInitializer sci)
        Test if the ServletContainerIntializer is excluded by the o.e.j.containerInitializerExclusionPattern
        Parameters:
        sci - the ServletContainerIntializer
        Returns:
        true if the ServletContainerIntializer is excluded
      • isFromContainerClassPath

        public boolean isFromContainerClassPath​(WebAppContext context,
                                                javax.servlet.ServletContainerInitializer sci)
        Test if the ServletContainerInitializer is from the container classpath
        Parameters:
        context - the context for the webapp classpath
        sci - the ServletContainerIntializer
        Returns:
        true if ServletContainerIntializer is from container classpath
      • isFromWebInfClasses

        public boolean isFromWebInfClasses​(WebAppContext context,
                                           Resource sci)
        Test if the ServletContainerInitializer is from WEB-INF/classes
        Parameters:
        context - the webapp to test
        sci - a Resource representing the SCI
        Returns:
        true if the sci Resource is inside a WEB-INF/classes directory, false otherwise
      • getNonExcludedInitializers

        public java.util.List<javax.servlet.ServletContainerInitializer> getNonExcludedInitializers​(WebAppContext context)
                                                                                             throws java.lang.Exception
        Get SCIs that are not excluded from consideration
        Parameters:
        context - the web app context
        Returns:
        the list of non-excluded servlet container initializers
        Throws:
        java.lang.Exception - if unable to get list
      • getInitializerOrdering

        public AnnotationConfiguration.ServletContainerInitializerOrdering getInitializerOrdering​(WebAppContext context)
        Jetty-specific extension that allows an ordering to be applied across ALL ServletContainerInitializers.
        Parameters:
        context - the context for the initializer ordering configuration
        Returns:
        the ordering of the ServletContainerIntializer's
      • parseContainerPath

        public void parseContainerPath​(WebAppContext context,
                                       AnnotationParser parser)
                                throws java.lang.Exception
        Scan jars on container path.
        Parameters:
        context - the context for the scan
        parser - the parser to scan with
        Throws:
        java.lang.Exception - if unable to scan
      • parseWebInfLib

        public void parseWebInfLib​(WebAppContext context,
                                   AnnotationParser parser)
                            throws java.lang.Exception
        Scan jars in WEB-INF/lib
        Parameters:
        context - the context for the scan
        parser - the annotation parser to use
        Throws:
        java.lang.Exception - if unable to scan and/or parse
      • parseWebInfClasses

        public void parseWebInfClasses​(WebAppContext context,
                                       AnnotationParser parser)
                                throws java.lang.Exception
        Scan classes in WEB-INF/classes
        Parameters:
        context - the context for the scan
        parser - the annotation parser to use
        Throws:
        java.lang.Exception - if unable to scan and/or parse
      • getFragmentFromJar

        public FragmentDescriptor getFragmentFromJar​(Resource jar,
                                                     java.util.List<FragmentDescriptor> frags)
                                              throws java.lang.Exception
        Get the web-fragment.xml from a jar
        Parameters:
        jar - the jar to look in for a fragment
        frags - the fragments previously found
        Returns:
        true if the fragment if found, or null of not found
        Throws:
        java.lang.Exception - if unable to determine the the fragment contains
      • isMetaDataComplete

        public boolean isMetaDataComplete​(WebDescriptor d)