Class ServletContainerInitializerClasses


  • public final class ServletContainerInitializerClasses
    extends Object
    Manages scanned classes inside OSGi container.

    It doesn't do anything outside of OSGi.

    Since:
    Author:
    Vaadin Ltd
    • Constructor Detail

      • ServletContainerInitializerClasses

        public ServletContainerInitializerClasses()
    • Method Detail

      • setServletContainerInitializers

        public void setServletContainerInitializers​(Collection<Class<? extends javax.servlet.ServletContainerInitializer>> contextInitializers)
        Sets the discovered servlet context initializer classes.

        The OSGi bundle tracker is used to scan all classes in bundles and it also scans flow-server module for servlet initializer classes. They are set using this method once they are collected.

        Parameters:
        contextInitializers - servlet context initializer classes
      • hasInitializers

        public boolean hasInitializers()
        Checks whether the servlet initializers are discovered.
        Returns:
        true if servlet initializers are set, false otherwise
      • addScannedClasses

        public void addScannedClasses​(Map<Long,​Collection<Class<?>>> extenderClasses)
        Adds scanned classes in active bundles.

        The map contains a bundle id as a key and classes discovered in the bundle as a value.

        Parameters:
        extenderClasses - a map with discovered classes in active bundles
      • removeScannedClasses

        public void removeScannedClasses​(Long bundleId)
        Removes classes from the bundle identified by the bundleId.

        When a bundle becomes inactive its classes should not be used anymore. This method removes the classes from the bundle from the collection of discovered classes.

        Parameters:
        bundleId - the bundle identifier
      • addContext

        public void addContext​(javax.servlet.ServletContext servletContext)
        Adds the servletContext to run servlet context initializers against of.
        Parameters:
        servletContext - the servlet context to run servlet context initializers
      • removeContext

        public void removeContext​(javax.servlet.ServletContext servletContext)
        Removes the servletContext from tracking contexts for servlet context initializers.
        Parameters:
        servletContext - the servlet context from tracking contexts