Class ContainerInitializer.ServletContainerInitializerServletContextListener

java.lang.Object
org.eclipse.jetty.ee10.servlet.listener.ContainerInitializer.ServletContainerInitializerServletContextListener
All Implemented Interfaces:
jakarta.servlet.ServletContextListener, EventListener
Enclosing class:
ContainerInitializer

public static class ContainerInitializer.ServletContainerInitializerServletContextListener extends Object implements jakarta.servlet.ServletContextListener
  • Constructor Details

    • ServletContainerInitializerServletContextListener

      public ServletContainerInitializerServletContextListener(jakarta.servlet.ServletContainerInitializer sci)
  • Method Details

    • addClasses

      Add classes to be passed to the ServletContainerInitializer.onStartup(Set, ServletContext) call.

      Note that these classes will be loaded using the context classloader for the ServletContext initialization phase.

      Parameters:
      classNames - the class names to load and pass into the ServletContainerInitializer.onStartup(Set, ServletContext) call
      Returns:
      this configured ContainerInitializer.ServletContainerInitializerServletContextListener instance.
    • addClasses

      Add classes to be passed to the ServletContainerInitializer.onStartup(Set, ServletContext) call.

      Note that these classes will exist on the classloader that was used to call this method. If you want the classes to be loaded using the context classloader for the ServletContext then use the String form of the classes via the addClasses(String...) method.

      Parameters:
      classes - the classes to pass into the ServletContainerInitializer.onStartup(Set, ServletContext) call
      Returns:
      this configured ContainerInitializer.ServletContainerInitializerServletContextListener instance.
    • afterStartup

      public ContainerInitializer.ServletContainerInitializerServletContextListener afterStartup(Consumer<jakarta.servlet.ServletContext> consumer)
      Add a optional consumer to execute once the ServletContainerInitializer.onStartup(Set, ServletContext) has been called successfully.

      This would be for actions to perform on a ServletContext once this specific SCI has completed its execution. Actions that would require specific configurations that the SCI provides to be present on the ServletContext to function properly.

      This consumer is typically used for Embedded Jetty users to configure Jetty for their specific needs.

      Parameters:
      consumer - the consumer to execute after the SCI has executed
      Returns:
      this configured ContainerInitializer.ServletContainerInitializerServletContextListener instance.
    • contextInitialized

      public void contextInitialized(jakarta.servlet.ServletContextEvent sce)
      Specified by:
      contextInitialized in interface jakarta.servlet.ServletContextListener
    • getClasses

      public Set<Class<?>> getClasses()
    • contextDestroyed

      public void contextDestroyed(jakarta.servlet.ServletContextEvent sce)
      Specified by:
      contextDestroyed in interface jakarta.servlet.ServletContextListener