Interface ServletContainerProvider
- All Known Subinterfaces:
ExtendedServletContainerProvider
- All Known Implementing Classes:
NoOpServletContainerProvider
public interface ServletContainerProvider
This is internal Jersey SPI to hook to Jersey servlet initialization process driven by
org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer.
The provider implementation class is registered via META-INF/services.- Since:
- 2.4.1
- Author:
- Libor Kramolis
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(ResourceConfig resourceConfig) This method is called for eachServletContainerinstance initialization, i.e. duringWebComponentinitialization.voidonRegister(jakarta.servlet.ServletContext servletContext, Set<String> servletNames) Notifies the provider about all registered Jersey servlets by its names.voidpostInit(jakarta.servlet.ServletContext servletContext, Set<Class<?>> classes, Set<String> servletNames) Do your post-initialization job after Jersey finished its servlet initialization.voidDo your pre-initialization job before Jersey starts its servlet initialization.
-
Method Details
-
preInit
void preInit(jakarta.servlet.ServletContext servletContext, Set<Class<?>> classes) throws jakarta.servlet.ServletException Do your pre-initialization job before Jersey starts its servlet initialization. It is allowed to configureServletContextor add/remove servlet registrations. ParameterservletNamescontains list of names of currently registered Jersey servlets.- Parameters:
servletContext- theServletContextof the JAX-RS/Jersey web application that is being started.classes- the mutable Set of application classes that extendApplication, implement, or have been annotated with the class typesPath,ProviderorApplicationPath. May be empty, nevernull.- Throws:
jakarta.servlet.ServletException- if an error has occurred.jakarta.servlet.ServletContainerInitializer.onStartupis interrupted.
-
postInit
void postInit(jakarta.servlet.ServletContext servletContext, Set<Class<?>> classes, Set<String> servletNames) throws jakarta.servlet.ServletException Do your post-initialization job after Jersey finished its servlet initialization. It is allowed to configureServletContextor add/remove servlet registrations. ParameterservletNamescontains list of names of currently registered Jersey servlets.- Parameters:
servletContext- theServletContextof the JAX-RS/Jersey web application that is being started.classes- the mutable Set of application classes that extendApplication, implement, or have been annotated with the class typesPath,ProviderorApplicationPath. May be empty, nevernull.servletNames- the Immutable set of Jersey's ServletContainer names. May be empty, nevernull.- Throws:
jakarta.servlet.ServletException- if an error has occurred.jakarta.servlet.ServletContainerInitializer.onStartupis interrupted.
-
onRegister
void onRegister(jakarta.servlet.ServletContext servletContext, Set<String> servletNames) throws jakarta.servlet.ServletException Notifies the provider about all registered Jersey servlets by its names. It is allowed to configureServletContext. Do not add/remove any servlet registrations here. ParameterservletNamescontains list of names of registered Jersey servlets. Currently it isServletContainerororg.glassfish.jersey.servlet.portability.PortableServletContainerservlets. It does not matter servlet container is configured inweb.xml, byorg.glassfish.jersey.servlet.init.JerseyServletContainerInitializeror by customer direct Servlet API calls.- Parameters:
servletContext- theServletContextof the JAX-RS/Jersey web application that is being started.servletNames- the Immutable set of Jersey's ServletContainer names. May be empty, nevernull.- Throws:
jakarta.servlet.ServletException- if an error has occurred.jakarta.servlet.ServletContainerInitializer.onStartupis interrupted.
-
configure
This method is called for eachServletContainerinstance initialization, i.e. duringWebComponentinitialization. The method is also called duringServletContainer.reload()orServletContainer.reload(ResourceConfig)methods invocation. It does not matter servlet container is configured inweb.xml, byorg.glassfish.jersey.servlet.init.JerseyServletContainerInitializeror by customer direct Servlet API calls.- Parameters:
resourceConfig- Jersey application configuration.- Throws:
jakarta.servlet.ServletException- if an error has occurred.org.glassfish.jersey.servlet.WebComponentconstruction is interrupted.
-