public abstract class AbstractServletHttpHandlerAdapterInitializer extends Object implements org.springframework.web.WebApplicationInitializer
WebApplicationInitializer
implementations that register a ServletHttpHandlerAdapter in the servlet context.
Concrete implementations are required to implement
createHttpHandler(), as well as getServletMappings(),
both of which get invoked from registerHandlerAdapter(ServletContext).
Further customization can be achieved by overriding
customizeRegistration(ServletRegistration.Dynamic).
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_SERVLET_NAME
The default servlet name.
|
| Constructor and Description |
|---|
AbstractServletHttpHandlerAdapterInitializer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract org.springframework.http.server.reactive.HttpHandler |
createHttpHandler()
Create the
HttpHandler. |
protected org.springframework.http.server.reactive.ServletHttpHandlerAdapter |
createServlet(org.springframework.http.server.reactive.HttpHandler httpHandler)
Create a
ServletHttpHandlerAdapter with the specified . |
protected void |
customizeRegistration(ServletRegistration.Dynamic registration)
Optionally perform further registration customization once
registerHandlerAdapter(ServletContext) has completed. |
protected abstract String[] |
getServletMappings()
Specify the servlet mapping(s) for the
ServletHttpHandlerAdapter —
for example "/", "/app", etc. |
protected String |
getServletName()
Return the name under which the
ServletHttpHandlerAdapter will be registered. |
void |
onStartup(ServletContext servletContext) |
protected void |
registerHandlerAdapter(ServletContext servletContext)
Register a
ServletHttpHandlerAdapter against the given servlet context. |
public static final String DEFAULT_SERVLET_NAME
getServletName().public AbstractServletHttpHandlerAdapterInitializer()
public void onStartup(ServletContext servletContext) throws ServletException
onStartup in interface org.springframework.web.WebApplicationInitializerServletExceptionprotected void registerHandlerAdapter(ServletContext servletContext)
ServletHttpHandlerAdapter against the given servlet context.
This method will create a HttpHandler using createHttpHandler(),
and use it to create a ServletHttpHandlerAdapter with the name returned by
getServletName(), and mapping it to the patterns
returned from getServletMappings().
Further customization can be achieved by overriding customizeRegistration(ServletRegistration.Dynamic) or
createServlet(HttpHandler).
servletContext - the context to register the servlet againstprotected String getServletName()
ServletHttpHandlerAdapter will be registered.
Defaults to DEFAULT_SERVLET_NAME.registerHandlerAdapter(ServletContext)protected abstract org.springframework.http.server.reactive.HttpHandler createHttpHandler()
HttpHandler.protected org.springframework.http.server.reactive.ServletHttpHandlerAdapter createServlet(org.springframework.http.server.reactive.HttpHandler httpHandler)
ServletHttpHandlerAdapter with the specified .
Default implementation returns a ServletHttpHandlerAdapter with the provided
httpHandler.
protected abstract String[] getServletMappings()
ServletHttpHandlerAdapter —
for example "/", "/app", etc.registerHandlerAdapter(ServletContext)protected void customizeRegistration(ServletRegistration.Dynamic registration)
registerHandlerAdapter(ServletContext) has completed.registration - the DispatcherServlet registration to be customizedregisterHandlerAdapter(ServletContext)