Class AnnotationConfiguration

  • All Implemented Interfaces:
    org.eclipse.jetty.webapp.Configuration

    public class AnnotationConfiguration
    extends org.eclipse.jetty.webapp.AbstractConfiguration
    Configuration for Annotations
    • Constructor Detail

      • AnnotationConfiguration

        public AnnotationConfiguration()
    • Method Detail

      • preConfigure

        public void preConfigure​(org.eclipse.jetty.webapp.WebAppContext context)
                          throws Exception
        Specified by:
        preConfigure in interface org.eclipse.jetty.webapp.Configuration
        Overrides:
        preConfigure in class org.eclipse.jetty.webapp.AbstractConfiguration
        Throws:
        Exception
      • deconfigure

        public void deconfigure​(org.eclipse.jetty.webapp.WebAppContext context)
                         throws Exception
        Specified by:
        deconfigure in interface org.eclipse.jetty.webapp.Configuration
        Overrides:
        deconfigure in class org.eclipse.jetty.webapp.AbstractConfiguration
        Throws:
        Exception
      • configure

        public void configure​(org.eclipse.jetty.webapp.WebAppContext context)
                       throws Exception
        Specified by:
        configure in interface org.eclipse.jetty.webapp.Configuration
        Overrides:
        configure in class org.eclipse.jetty.webapp.AbstractConfiguration
        Throws:
        Exception
        See Also:
        AbstractConfiguration.configure(org.eclipse.jetty.webapp.WebAppContext)
      • postConfigure

        public void postConfigure​(org.eclipse.jetty.webapp.WebAppContext context)
                           throws Exception
        Specified by:
        postConfigure in interface org.eclipse.jetty.webapp.Configuration
        Overrides:
        postConfigure in class org.eclipse.jetty.webapp.AbstractConfiguration
        Throws:
        Exception
        See Also:
        AbstractConfiguration.postConfigure(org.eclipse.jetty.webapp.WebAppContext)
      • scanForAnnotations

        protected void scanForAnnotations​(org.eclipse.jetty.webapp.WebAppContext context)
                                   throws Exception
        Perform scanning of classes for annotations
        Parameters:
        context - the context for the scan
        Throws:
        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​(org.eclipse.jetty.webapp.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​(org.eclipse.jetty.webapp.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
      • cloneConfigure

        public void cloneConfigure​(org.eclipse.jetty.webapp.WebAppContext template,
                                   org.eclipse.jetty.webapp.WebAppContext context)
                            throws Exception
        Specified by:
        cloneConfigure in interface org.eclipse.jetty.webapp.Configuration
        Overrides:
        cloneConfigure in class org.eclipse.jetty.webapp.AbstractConfiguration
        Throws:
        Exception
        See Also:
        AbstractConfiguration.cloneConfigure(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.webapp.WebAppContext)
      • createServletContainerInitializerAnnotationHandlers

        public void createServletContainerInitializerAnnotationHandlers​(org.eclipse.jetty.webapp.WebAppContext context,
                                                                        List<ServletContainerInitializer> scis)
                                                                 throws Exception
        Throws:
        Exception
      • isFromExcludedJar

        public boolean isFromExcludedJar​(org.eclipse.jetty.webapp.WebAppContext context,
                                         ServletContainerInitializer sci,
                                         org.eclipse.jetty.util.resource.Resource sciResource)
                                  throws Exception
        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
        Throws:
        Exception - if unable to determine exclusion
      • matchesExclusionPattern

        public boolean matchesExclusionPattern​(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​(org.eclipse.jetty.webapp.WebAppContext context,
                                                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
      • getNonExcludedInitializers

        public List<ServletContainerInitializer> getNonExcludedInitializers​(org.eclipse.jetty.webapp.WebAppContext context)
                                                                     throws 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:
        Exception - if unable to get list
      • getInitializerOrdering

        public AnnotationConfiguration.ServletContainerInitializerOrdering getInitializerOrdering​(org.eclipse.jetty.webapp.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​(org.eclipse.jetty.webapp.WebAppContext context,
                                       AnnotationParser parser)
                                throws Exception
        Scan jars on container path.
        Parameters:
        context - the context for the scan
        parser - the parser to scan with
        Throws:
        Exception - if unable to scan
      • parseWebInfLib

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

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

        public org.eclipse.jetty.webapp.FragmentDescriptor getFragmentFromJar​(org.eclipse.jetty.util.resource.Resource jar,
                                                                              List<org.eclipse.jetty.webapp.FragmentDescriptor> frags)
                                                                       throws 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:
        Exception - if unable to determine the the fragment contains
      • isMetaDataComplete

        public boolean isMetaDataComplete​(org.eclipse.jetty.webapp.WebDescriptor d)