public abstract class AbstractServletWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableServletWebServerFactory
ConfigurableServletWebServerFactory
implementations.Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
AbstractServletWebServerFactory()
Create a new
AbstractServletWebServerFactory instance. |
AbstractServletWebServerFactory(int port)
Create a new
AbstractServletWebServerFactory instance with the specified
port. |
AbstractServletWebServerFactory(java.lang.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
ServletContextInitializer s to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
void |
addWebListeners(java.lang.String... webListenerClassNames)
Adds web listeners that will be registered with the servlet container.
|
java.lang.String |
getContextPath()
Returns the context path for the web server.
|
java.util.List<CookieSameSiteSupplier> |
getCookieSameSiteSuppliers() |
java.lang.String |
getDisplayName() |
java.io.File |
getDocumentRoot()
Returns the document root which will be used by the web context to serve static
files.
|
java.util.Map<java.lang.String,java.lang.String> |
getInitParameters() |
Jsp |
getJsp() |
java.util.Map<java.util.Locale,java.nio.charset.Charset> |
getLocaleCharsetMappings()
Return the Locale to Charset mappings.
|
MimeMappings |
getMimeMappings()
Returns the mime-type mappings.
|
Session |
getSession() |
protected java.util.List<java.net.URL> |
getUrlsOfJarsWithMetaInfResources() |
protected java.io.File |
getValidDocumentRoot()
Returns the absolute document root when it points to a valid directory, logging a
warning and returning
null otherwise. |
protected java.io.File |
getValidSessionStoreDir() |
protected java.io.File |
getValidSessionStoreDir(boolean mkdirs) |
protected java.util.Set<java.lang.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(java.lang.String contextPath)
Sets the context path for the web server.
|
void |
setCookieSameSiteSuppliers(java.util.List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers)
Sets
CookieSameSiteSuppliers that should be used to
obtain the Cookie.SameSite attribute of any added cookie. |
void |
setDisplayName(java.lang.String displayName)
Sets the display name of the application deployed in the web server.
|
void |
setDocumentRoot(java.io.File documentRoot)
Sets the document root directory which will be used by the web context to serve
static files.
|
void |
setInitializers(java.util.List<? extends ServletContextInitializer> initializers)
Sets
ServletContextInitializer that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. |
void |
setInitParameters(java.util.Map<java.lang.String,java.lang.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(java.util.Map<java.util.Locale,java.nio.charset.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, getOrCreateSslStoreProvider, getPort, getServerHeader, getShutdown, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
addErrorPages
getWebServer
public AbstractServletWebServerFactory()
AbstractServletWebServerFactory
instance.public AbstractServletWebServerFactory(int port)
AbstractServletWebServerFactory
instance with the specified
port.port
- the port number for the web serverpublic AbstractServletWebServerFactory(java.lang.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 java.lang.String getContextPath()
public void setContextPath(java.lang.String contextPath)
ConfigurableServletWebServerFactory
setContextPath
in interface ConfigurableServletWebServerFactory
contextPath
- the contextPath to setpublic java.lang.String getDisplayName()
public void setDisplayName(java.lang.String displayName)
ConfigurableServletWebServerFactory
setDisplayName
in interface ConfigurableServletWebServerFactory
displayName
- the displayName to setpublic boolean isRegisterDefaultServlet()
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
ConfigurableServletWebServerFactory
false
since
2.4.setRegisterDefaultServlet
in interface ConfigurableServletWebServerFactory
registerDefaultServlet
- if the default servlet should be registeredpublic MimeMappings getMimeMappings()
public void setMimeMappings(MimeMappings mimeMappings)
ConfigurableServletWebServerFactory
setMimeMappings
in interface ConfigurableServletWebServerFactory
mimeMappings
- the mime type mappings (defaults to
MimeMappings.DEFAULT
)public java.io.File getDocumentRoot()
public void setDocumentRoot(java.io.File documentRoot)
ConfigurableServletWebServerFactory
setDocumentRoot
in interface ConfigurableServletWebServerFactory
documentRoot
- the document root or null
if not requiredpublic void setInitializers(java.util.List<? extends ServletContextInitializer> initializers)
ConfigurableServletWebServerFactory
ServletContextInitializer
that should be applied in addition to
ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.setInitializers
in interface ConfigurableServletWebServerFactory
initializers
- the initializers to setConfigurableServletWebServerFactory.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)
public void addInitializers(ServletContextInitializer... initializers)
ConfigurableServletWebServerFactory
ServletContextInitializer
s to those that should be applied in addition
to ServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.addInitializers
in interface ConfigurableServletWebServerFactory
initializers
- the initializers to addConfigurableServletWebServerFactory.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)
public Jsp getJsp()
public void setJsp(Jsp jsp)
ConfigurableServletWebServerFactory
setJsp
in interface ConfigurableServletWebServerFactory
jsp
- the JSP servlet configurationpublic Session getSession()
public void setSession(Session session)
ConfigurableServletWebServerFactory
setSession
in interface ConfigurableServletWebServerFactory
session
- the session configurationpublic java.util.Map<java.util.Locale,java.nio.charset.Charset> getLocaleCharsetMappings()
public void setLocaleCharsetMappings(java.util.Map<java.util.Locale,java.nio.charset.Charset> localeCharsetMappings)
ConfigurableServletWebServerFactory
setLocaleCharsetMappings
in interface ConfigurableServletWebServerFactory
localeCharsetMappings
- the Locale to Charset mappingspublic void setInitParameters(java.util.Map<java.lang.String,java.lang.String> initParameters)
ConfigurableServletWebServerFactory
ServletContext
.setInitParameters
in interface ConfigurableServletWebServerFactory
initParameters
- the init parameterspublic java.util.Map<java.lang.String,java.lang.String> getInitParameters()
public void setCookieSameSiteSuppliers(java.util.List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers)
ConfigurableServletWebServerFactory
CookieSameSiteSuppliers
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 ConfigurableServletWebServerFactory
cookieSameSiteSuppliers
- the suppliers to addConfigurableServletWebServerFactory.addCookieSameSiteSuppliers(org.springframework.boot.web.servlet.server.CookieSameSiteSupplier...)
public void addCookieSameSiteSuppliers(CookieSameSiteSupplier... cookieSameSiteSuppliers)
ConfigurableServletWebServerFactory
CookieSameSiteSuppliers
to those that should be
used to obtain the Cookie.SameSite
attribute of any added cookie.addCookieSameSiteSuppliers
in interface ConfigurableServletWebServerFactory
cookieSameSiteSuppliers
- the suppliers to addConfigurableServletWebServerFactory.setCookieSameSiteSuppliers(java.util.List<? extends org.springframework.boot.web.servlet.server.CookieSameSiteSupplier>)
public java.util.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 false
protected final java.io.File getValidDocumentRoot()
null
otherwise.protected final java.util.List<java.net.URL> getUrlsOfJarsWithMetaInfResources()
protected final java.io.File getValidSessionStoreDir()
protected final java.io.File getValidSessionStoreDir(boolean mkdirs)
public void addWebListeners(java.lang.String... webListenerClassNames)
WebListenerRegistry
addWebListeners
in interface WebListenerRegistry
webListenerClassNames
- the class names of the web listenersprotected final java.util.Set<java.lang.String> getWebListenerClassNames()