public class NoOpServletContainerProvider extends Object implements ExtendedServletContainerProvider
ExtendedServletContainerProvider
that provides
dummy no-op method implementation. It should be convenient to extend if you only need to implement
a subset of the original SPI methods.Modifier and Type | Field and Description |
---|---|
Type |
HTTP_SERVLET_REQUEST_TYPE |
Type |
HTTP_SERVLET_RESPONSE_TYPE |
Constructor and Description |
---|
NoOpServletContainerProvider() |
Modifier and Type | Method and Description |
---|---|
boolean |
bindsServletRequestResponse()
Used by Jersey runtime to tell if the extension covers HTTP Servlet request response
handling with respect to underlying injection manager.
|
void |
configure(ResourceConfig resourceConfig)
This method is called for each
ServletContainer instance initialization,
i.e. |
RequestScopedInitializerProvider |
getRequestScopedInitializerProvider()
Give me a
RequestScopedInitializerProvider instance, that will be utilized
at runtime to set the actual HTTP Servlet request and response. |
void |
onRegister(jakarta.servlet.ServletContext servletContext,
Set<String> servletNames)
Notifies the provider about all registered Jersey servlets by its names.
|
void |
postInit(jakarta.servlet.ServletContext servletContext,
Set<Class<?>> classes,
Set<String> servletNames)
Do your post-initialization job after Jersey finished its servlet initialization.
|
void |
preInit(jakarta.servlet.ServletContext servletContext,
Set<Class<?>> classes)
Do your pre-initialization job before Jersey starts its servlet initialization.
|
public final Type HTTP_SERVLET_REQUEST_TYPE
public final Type HTTP_SERVLET_RESPONSE_TYPE
public void preInit(jakarta.servlet.ServletContext servletContext, Set<Class<?>> classes) throws jakarta.servlet.ServletException
ServletContainerProvider
ServletContext
or add/remove servlet registrations.
Parameter servletNames
contains list of names of currently registered Jersey servlets.preInit
in interface ServletContainerProvider
servletContext
- the ServletContext
of the JAX-RS/Jersey web application that is being started.classes
- the mutable Set of application classes that extend Application
,
implement, or have been annotated with the class types Path
,
Provider
or ApplicationPath
.
May be empty, never null
.jakarta.servlet.ServletException
- if an error has occurred. jakarta.servlet.ServletContainerInitializer.onStartup
is interrupted.public void postInit(jakarta.servlet.ServletContext servletContext, Set<Class<?>> classes, Set<String> servletNames)
ServletContainerProvider
ServletContext
or add/remove servlet registrations.
Parameter servletNames
contains list of names of currently registered Jersey servlets.postInit
in interface ServletContainerProvider
servletContext
- the ServletContext
of the JAX-RS/Jersey web application that is being started.classes
- the mutable Set of application classes that extend Application
,
implement, or have been annotated with the class types Path
,
Provider
or ApplicationPath
.
May be empty, never null
.servletNames
- the Immutable set of Jersey's ServletContainer names. May be empty, never null
.public void onRegister(jakarta.servlet.ServletContext servletContext, Set<String> servletNames) throws jakarta.servlet.ServletException
ServletContainerProvider
ServletContext
. Do not add/remove any servlet registrations here.
Parameter servletNames
contains list of names of registered Jersey servlets.
Currently it is ServletContainer
or
org.glassfish.jersey.servlet.portability.PortableServletContainer
servlets.
It does not matter servlet container is configured in web.xml
,
by org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer
or by customer direct Servlet API calls.onRegister
in interface ServletContainerProvider
servletContext
- the ServletContext
of the JAX-RS/Jersey web application that is being started.servletNames
- the Immutable set of Jersey's ServletContainer names. May be empty, never null
.jakarta.servlet.ServletException
- if an error has occurred. jakarta.servlet.ServletContainerInitializer.onStartup
is interrupted.public void configure(ResourceConfig resourceConfig) throws jakarta.servlet.ServletException
ServletContainerProvider
ServletContainer
instance initialization,
i.e. during WebComponent
initialization.
The method is also called during ServletContainer.reload()
or
ServletContainer.reload(ResourceConfig)
methods invocation.
It does not matter servlet container is configured in web.xml
,
by org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer
or by customer direct Servlet API calls.configure
in interface ServletContainerProvider
resourceConfig
- Jersey application configuration.jakarta.servlet.ServletException
- if an error has occurred. org.glassfish.jersey.servlet.WebComponent
construction
is interrupted.public boolean bindsServletRequestResponse()
ExtendedServletContainerProvider
true
, if your implementation configures HK2 bindings
for HttpServletRequest
and HttpServletResponse
in ServletContainerProvider.configure(ResourceConfig)
method
and also provides a RequestScopedInitializer
implementation
via ExtendedServletContainerProvider.getRequestScopedInitializerProvider()
.bindsServletRequestResponse
in interface ExtendedServletContainerProvider
true
if the extension fully covers HTTP request/response handling.public RequestScopedInitializerProvider getRequestScopedInitializerProvider()
ExtendedServletContainerProvider
RequestScopedInitializerProvider
instance, that will be utilized
at runtime to set the actual HTTP Servlet request and response.
The provider returned will be used at runtime for every and each incoming request
so that the actual request/response instances could be made accessible
from Jersey injection manager.getRequestScopedInitializerProvider
in interface ExtendedServletContainerProvider
Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.