Class ServletContainerInitializerUtil


  • public class ServletContainerInitializerUtil
    extends Object
    Utility class - contains util methods used for implementation of pluggable Shared Library features
    Author:
    Vijay Ramachandran
    • Constructor Detail

      • ServletContainerInitializerUtil

        public ServletContainerInitializerUtil()
    • Method Detail

      • getServletContainerInitializers

        public static Iterable<jakarta.servlet.ServletContainerInitializer> getServletContainerInitializers​(Map<String,​String> webFragmentMap,
                                                                                                            List<Object> absoluteOrderingList,
                                                                                                            boolean hasOthers,
                                                                                                            ClassLoader cl,
                                                                                                            boolean servletInitializersEnabled)
        Given a class loader, check for ServletContainerInitializer implementations in any JAR file in the classpath
        Parameters:
        webFragmentMap -
        absoluteOrderingList -
        cl - The ClassLoader to be used to find JAR files
        hasOthers -
        servletInitializersEnabled -
        Returns:
        Iterable over all ServletContainerInitializers that were found
      • getInterestList

        public static Map<Class<?>,​List<Class<? extends jakarta.servlet.ServletContainerInitializer>>> getInterestList​(Iterable<jakarta.servlet.ServletContainerInitializer> initializers)
        Builds a mapping of classes to the list of ServletContainerInitializers interested in them
        Parameters:
        initializers - an Iterable over all ServletContainerInitializers that need to be considered
        Returns:
        Mapping of classes to list of ServletContainerInitializers interested in them
      • getInitializerList

        public static Map<Class<? extends jakarta.servlet.ServletContainerInitializer>,​Set<Class<?>>> getInitializerList​(Iterable<jakarta.servlet.ServletContainerInitializer> initializers,
                                                                                                                               Map<Class<?>,​List<Class<? extends jakarta.servlet.ServletContainerInitializer>>> interestList,
                                                                                                                               org.glassfish.hk2.classmodel.reflect.Types types,
                                                                                                                               ClassLoader cl,
                                                                                                                               boolean isStandalone)
        Given an interestlist that was built above, and a class loader, scan the entire web app's classes and libraries looking for classes that extend/implement/use the annotations of a class present in the interest list
        Parameters:
        initializers - Iterable over all ServletContainerInitializers that were discovered
        interestList - The interestList built by the previous util method
        cl - The classloader to be used to load classes in WAR
        Returns:
        Map<Class<? extends ServletContainerInitializer>, Set<Class<?>>> A Map of ServletContainerInitializer classes to be called and arguments to be passed to them