public abstract class AbstractServletWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableServletWebServerFactory
ConfigurableServletWebServerFactory implementations.| Constructor and Description |
|---|
AbstractServletWebServerFactory()
Create a new
AbstractServletWebServerFactory instance. |
AbstractServletWebServerFactory(int port)
Create a new
AbstractServletWebServerFactory instance with the specified
port. |
AbstractServletWebServerFactory(String contextPath,
int port)
Create a new
AbstractServletWebServerFactory instance with the specified
context path and port. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCookieSameSiteSuppliers(CookieSameSiteSupplier... cookieSameSiteSuppliers)
Add
CookieSameSiteSuppliers to those that should be
used to obtain the Cookie.SameSite attribute of any added cookie. |
void |
addInitializers(ServletContextInitializer... initializers)
Add
ServletContextInitializers to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
void |
addWebListeners(String... webListenerClassNames)
Adds web listeners that will be registered with the servlet container.
|
String |
getContextPath()
Returns the context path for the web server.
|
List<CookieSameSiteSupplier> |
getCookieSameSiteSuppliers() |
String |
getDisplayName() |
File |
getDocumentRoot()
Returns the document root which will be used by the web context to serve static
files.
|
Map<String,String> |
getInitParameters() |
Jsp |
getJsp() |
Map<Locale,Charset> |
getLocaleCharsetMappings()
Return the Locale to Charset mappings.
|
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
Session |
getSession() |
protected List<URL> |
getUrlsOfJarsWithMetaInfResources() |
protected File |
getValidDocumentRoot()
Returns the absolute document root when it points to a valid directory, logging a
warning and returning
null otherwise. |
protected File |
getValidSessionStoreDir() |
protected File |
getValidSessionStoreDir(boolean mkdirs) |
protected Set<String> |
getWebListenerClassNames() |
boolean |
isRegisterDefaultServlet()
Flag to indicate that the default servlet should be registered.
|
protected ServletContextInitializer[] |
mergeInitializers(ServletContextInitializer... initializers)
Utility method that can be used by subclasses wishing to combine the specified
ServletContextInitializer parameters with those defined in this instance. |
void |
setContextPath(String contextPath)
Sets the context path for the web server.
|
void |
setCookieSameSiteSuppliers(List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers)
Sets
CookieSameSiteSuppliers that should be used to
obtain the Cookie.SameSite attribute of any added cookie. |
void |
setDisplayName(String displayName)
Sets the display name of the application deployed in the web server.
|
void |
setDocumentRoot(File documentRoot)
Sets the document root directory which will be used by the web context to serve
static files.
|
void |
setInitializers(List<? extends ServletContextInitializer> initializers)
Sets
ServletContextInitializer that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
void |
setInitParameters(Map<String,String> initParameters)
Sets the init parameters that are applied to the container's
ServletContext. |
void |
setJsp(Jsp jsp)
Sets the configuration that will be applied to the server's JSP servlet.
|
void |
setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
Sets the Locale to Charset mappings.
|
void |
setMimeMappings(MimeMappings mimeMappings)
Sets the mime-type mappings.
|
void |
setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered.
|
void |
setSession(Session session)
Sets the configuration that will be applied to the container's HTTP session
support.
|
protected boolean |
shouldRegisterJspServlet()
Returns whether or not the JSP servlet should be registered with the web server.
|
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getShutdown, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvideraddErrorPagesgetWebServerprotected final Log logger
public AbstractServletWebServerFactory()
AbstractServletWebServerFactory instance.public AbstractServletWebServerFactory(int port)
AbstractServletWebServerFactory instance with the specified
port.port - the port number for the web serverpublic AbstractServletWebServerFactory(String contextPath, int port)
AbstractServletWebServerFactory instance with the specified
context path and port.contextPath - the context path for the web serverport - the port number for the web serverpublic String getContextPath()
public void setContextPath(String contextPath)
ConfigurableServletWebServerFactorysetContextPath in interface ConfigurableServletWebServerFactorycontextPath - the contextPath to setpublic String getDisplayName()
public void setDisplayName(String displayName)
ConfigurableServletWebServerFactorysetDisplayName in interface ConfigurableServletWebServerFactorydisplayName - the displayName to setpublic boolean isRegisterDefaultServlet()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableServletWebServerFactoryfalse since
2.4.setRegisterDefaultServlet in interface ConfigurableServletWebServerFactoryregisterDefaultServlet - if the default servlet should be registeredpublic MimeMappings getMimeMappings()
public void setMimeMappings(MimeMappings mimeMappings)
ConfigurableServletWebServerFactorysetMimeMappings in interface ConfigurableServletWebServerFactorymimeMappings - the mime type mappings (defaults to
MimeMappings.DEFAULT)public File getDocumentRoot()
public void setDocumentRoot(File documentRoot)
ConfigurableServletWebServerFactorysetDocumentRoot in interface ConfigurableServletWebServerFactorydocumentRoot - the document root or null if not requiredpublic void setInitializers(List<? extends ServletContextInitializer> initializers)
ConfigurableServletWebServerFactoryServletContextInitializer that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.setInitializers in interface ConfigurableServletWebServerFactoryinitializers - the initializers to setConfigurableServletWebServerFactory.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)public void addInitializers(ServletContextInitializer... initializers)
ConfigurableServletWebServerFactoryServletContextInitializers to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.addInitializers in interface ConfigurableServletWebServerFactoryinitializers - the initializers to addConfigurableServletWebServerFactory.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)public Jsp getJsp()
public void setJsp(Jsp jsp)
ConfigurableServletWebServerFactorysetJsp in interface ConfigurableServletWebServerFactoryjsp - the JSP servlet configurationpublic Session getSession()
public void setSession(Session session)
ConfigurableServletWebServerFactorysetSession in interface ConfigurableServletWebServerFactorysession - the session configurationpublic Map<Locale,Charset> getLocaleCharsetMappings()
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
ConfigurableServletWebServerFactorysetLocaleCharsetMappings in interface ConfigurableServletWebServerFactorylocaleCharsetMappings - the Locale to Charset mappingspublic void setInitParameters(Map<String,String> initParameters)
ConfigurableServletWebServerFactoryServletContext.setInitParameters in interface ConfigurableServletWebServerFactoryinitParameters - the init parameterspublic void setCookieSameSiteSuppliers(List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers)
ConfigurableServletWebServerFactoryCookieSameSiteSuppliers that should be used to
obtain the Cookie.SameSite attribute of any added cookie. This method will replace
any previously set or added suppliers.setCookieSameSiteSuppliers in interface ConfigurableServletWebServerFactorycookieSameSiteSuppliers - the suppliers to addConfigurableServletWebServerFactory.addCookieSameSiteSuppliers(org.springframework.boot.web.servlet.server.CookieSameSiteSupplier...)public void addCookieSameSiteSuppliers(CookieSameSiteSupplier... cookieSameSiteSuppliers)
ConfigurableServletWebServerFactoryCookieSameSiteSuppliers to those that should be
used to obtain the Cookie.SameSite attribute of any added cookie.addCookieSameSiteSuppliers in interface ConfigurableServletWebServerFactorycookieSameSiteSuppliers - the suppliers to addConfigurableServletWebServerFactory.setCookieSameSiteSuppliers(java.util.List<? extends org.springframework.boot.web.servlet.server.CookieSameSiteSupplier>)public List<CookieSameSiteSupplier> getCookieSameSiteSuppliers()
protected final ServletContextInitializer[] mergeInitializers(ServletContextInitializer... initializers)
ServletContextInitializer parameters with those defined in this instance.initializers - the initializers to mergeprotected boolean shouldRegisterJspServlet()
true if the servlet should be registered, otherwise falseprotected final File getValidDocumentRoot()
null otherwise.protected final File getValidSessionStoreDir()
protected final File getValidSessionStoreDir(boolean mkdirs)
public void addWebListeners(String... webListenerClassNames)
WebListenerRegistryaddWebListeners in interface WebListenerRegistrywebListenerClassNames - the class names of the web listeners