Class ContainerInitializer.ServletContainerInitializerServletContextListener
java.lang.Object
org.eclipse.jetty.servlet.listener.ContainerInitializer.ServletContainerInitializerServletContextListener
- All Implemented Interfaces:
EventListener
,javax.servlet.ServletContextListener
- Enclosing class:
- ContainerInitializer
public static class ContainerInitializer.ServletContainerInitializerServletContextListener
extends Object
implements javax.servlet.ServletContextListener
-
Constructor Summary
ConstructorDescriptionServletContainerInitializerServletContextListener
(javax.servlet.ServletContainerInitializer sci) -
Method Summary
Modifier and TypeMethodDescriptionaddClasses
(Class<?>... classes) Add classes to be passed to theServletContainerInitializer.onStartup(Set, ServletContext)
call.addClasses
(String... classNames) Add classes to be passed to theServletContainerInitializer.onStartup(Set, ServletContext)
call.afterStartup
(Consumer<javax.servlet.ServletContext> consumer) Add a optional consumer to execute once theServletContainerInitializer.onStartup(Set, ServletContext)
has been called successfully.void
contextDestroyed
(javax.servlet.ServletContextEvent sce) void
contextInitialized
(javax.servlet.ServletContextEvent sce)
-
Constructor Details
-
ServletContainerInitializerServletContextListener
public ServletContainerInitializerServletContextListener(javax.servlet.ServletContainerInitializer sci)
-
-
Method Details
-
addClasses
public ContainerInitializer.ServletContainerInitializerServletContextListener addClasses(String... classNames) Add classes to be passed to theServletContainerInitializer.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 theServletContainerInitializer.onStartup(Set, ServletContext)
call- Returns:
- this configured
ContainerInitializer.ServletContainerInitializerServletContextListener
instance.
-
addClasses
public ContainerInitializer.ServletContainerInitializerServletContextListener addClasses(Class<?>... classes) Add classes to be passed to theServletContainerInitializer.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 theServletContainerInitializer.onStartup(Set, ServletContext)
call- Returns:
- this configured
ContainerInitializer.ServletContainerInitializerServletContextListener
instance.
-
afterStartup
public ContainerInitializer.ServletContainerInitializerServletContextListener afterStartup(Consumer<javax.servlet.ServletContext> consumer) Add a optional consumer to execute once theServletContainerInitializer.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(javax.servlet.ServletContextEvent sce) - Specified by:
contextInitialized
in interfacejavax.servlet.ServletContextListener
-
getClasses
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce) - Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
-