Class ContainerInitializer.ServletContainerInitializerServletContextListener
- java.lang.Object
-
- org.eclipse.jetty.servlet.listener.ContainerInitializer.ServletContainerInitializerServletContextListener
-
- All Implemented Interfaces:
java.util.EventListener
,javax.servlet.ServletContextListener
- Enclosing class:
- ContainerInitializer
public static class ContainerInitializer.ServletContainerInitializerServletContextListener extends java.lang.Object implements javax.servlet.ServletContextListener
-
-
Constructor Summary
Constructors Constructor Description ServletContainerInitializerServletContextListener(javax.servlet.ServletContainerInitializer sci)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainerInitializer.ServletContainerInitializerServletContextListener
addClasses(java.lang.Class<?>... classes)
Add classes to be passed to theServletContainerInitializer.onStartup(Set, ServletContext)
call.ContainerInitializer.ServletContainerInitializerServletContextListener
addClasses(java.lang.String... classNames)
Add classes to be passed to theServletContainerInitializer.onStartup(Set, ServletContext)
call.ContainerInitializer.ServletContainerInitializerServletContextListener
afterStartup(java.util.function.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)
java.util.Set<java.lang.Class<?>>
getClasses()
-
-
-
Method Detail
-
addClasses
public ContainerInitializer.ServletContainerInitializerServletContextListener addClasses(java.lang.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(java.lang.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(java.util.function.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
public java.util.Set<java.lang.Class<?>> getClasses()
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent sce)
- Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
-
-