AbstractReactiveWebInitializer supports Servlet mapping

Issue: SPR-16155, SPR-16144
This commit is contained in:
Rossen Stoyanchev 2017-11-02 21:03:09 -04:00
parent 8c33ed02b3
commit 4534c5fbfc
1 changed files with 10 additions and 1 deletions

View File

@ -62,7 +62,7 @@ public abstract class AbstractReactiveWebInitializer implements WebApplicationIn
Assert.notNull(registration, "Failed to register servlet '" + servletName + "'.");
registration.setLoadOnStartup(1);
registration.addMapping("/");
registration.addMapping(getServletMapping());
registration.setAsyncSupported(true);
}
@ -93,4 +93,13 @@ public abstract class AbstractReactiveWebInitializer implements WebApplicationIn
*/
protected abstract Class<?>[] getConfigClasses();
/**
* Return the Servlet mapping to use. Only the default Servlet mapping '/'
* and path-based Servlet mappings such as '/api/*' are supported.
* <p>By default this is set to '/'.
*/
protected String getServletMapping() {
return "/";
}
}