类 AbstractServletWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
- 所有已实现的接口:
ConfigurableWebServerFactory
,ErrorPageRegistry
,WebServerFactory
,ConfigurableServletWebServerFactory
,ServletWebServerFactory
,WebListenerRegistry
- 直接已知子类:
JettyServletWebServerFactory
,TomcatServletWebServerFactory
,UndertowServletWebServerFactory
public abstract class AbstractServletWebServerFactory
extends AbstractConfigurableWebServerFactory
implements ConfigurableServletWebServerFactory
Abstract base class for
ConfigurableServletWebServerFactory
implementations.- 从以下版本开始:
- 2.0.0
- 作者:
- Phillip Webb, Dave Syer, Andy Wilkinson, Stephane Nicoll, Ivan Sopov, Eddú Meléndez, Brian Clozel
-
字段概要
字段 -
构造器概要
构造器构造器说明Create a newAbstractServletWebServerFactory
instance.AbstractServletWebServerFactory
(int port) Create a newAbstractServletWebServerFactory
instance with the specified port.AbstractServletWebServerFactory
(String contextPath, int port) Create a newAbstractServletWebServerFactory
instance with the specified context path and port. -
方法概要
修饰符和类型方法说明void
addCookieSameSiteSuppliers
(CookieSameSiteSupplier... cookieSameSiteSuppliers) AddCookieSameSiteSuppliers
to those that should be used to obtain theCookie.SameSite
attribute of any added cookie.void
addInitializers
(ServletContextInitializer... initializers) AddServletContextInitializer
s to those that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.void
addMimeMappings
(MimeMappings mimeMappings) Adds mime-type mappings.void
addWebListeners
(String... webListenerClassNames) Adds web listeners that will be registered with the servlet container.Returns the context path for the web server.Returns the document root which will be used by the web context to serve static files.getJsp()
Return the Locale to Charset mappings.Returns the mime-type mappings.protected final File
Returns the absolute document root when it points to a valid directory, logging a warning and returningnull
otherwise.protected final File
protected final File
getValidSessionStoreDir
(boolean mkdirs) boolean
Flag to indicate that the default servlet should be registered.protected final ServletContextInitializer[]
mergeInitializers
(ServletContextInitializer... initializers) Utility method that can be used by subclasses wishing to combine the specifiedServletContextInitializer
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) SetsCookieSameSiteSuppliers
that should be used to obtain theCookie.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) SetsServletContextInitializer
that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.void
setInitParameters
(Map<String, String> initParameters) Sets the init parameters that are applied to the container'sServletContext
.void
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
Returns whether the JSP servlet should be registered with the web server.从类继承的方法 org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getServerNameSslBundles, getShutdown, getSsl, getSslBundle, getSslBundles, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles
从接口继承的方法 org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
从接口继承的方法 org.springframework.boot.web.servlet.server.ServletWebServerFactory
getWebServer
-
字段详细资料
-
logger
-
-
构造器详细资料
-
AbstractServletWebServerFactory
public AbstractServletWebServerFactory()Create a newAbstractServletWebServerFactory
instance. -
AbstractServletWebServerFactory
public AbstractServletWebServerFactory(int port) Create a newAbstractServletWebServerFactory
instance with the specified port.- 参数:
port
- the port number for the web server
-
AbstractServletWebServerFactory
Create a newAbstractServletWebServerFactory
instance with the specified context path and port.- 参数:
contextPath
- the context path for the web serverport
- the port number for the web server
-
-
方法详细资料
-
getContextPath
Returns the context path for the web server. The path will start with "/" and not end with "/". The root context is represented by an empty string.- 返回:
- the context path
-
setContextPath
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the context path for the web server. The context should start with a "/" character but not end with a "/" character. The default context path can be specified using an empty string.- 指定者:
setContextPath
在接口中ConfigurableServletWebServerFactory
- 参数:
contextPath
- the contextPath to set
-
getDisplayName
-
setDisplayName
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the display name of the application deployed in the web server.- 指定者:
setDisplayName
在接口中ConfigurableServletWebServerFactory
- 参数:
displayName
- the displayName to set
-
isRegisterDefaultServlet
public boolean isRegisterDefaultServlet()Flag to indicate that the default servlet should be registered.- 返回:
- true if the default servlet is to be registered
-
setRegisterDefaultServlet
public void setRegisterDefaultServlet(boolean registerDefaultServlet) 从接口复制的说明:ConfigurableServletWebServerFactory
Set if the DefaultServlet should be registered. Defaults tofalse
since 2.4.- 指定者:
setRegisterDefaultServlet
在接口中ConfigurableServletWebServerFactory
- 参数:
registerDefaultServlet
- if the default servlet should be registered
-
getMimeMappings
Returns the mime-type mappings.- 返回:
- the mimeMappings the mime-type mappings.
-
setMimeMappings
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the mime-type mappings.- 指定者:
setMimeMappings
在接口中ConfigurableServletWebServerFactory
- 参数:
mimeMappings
- the mime type mappings (defaults toMimeMappings.DEFAULT
)
-
addMimeMappings
从接口复制的说明:ConfigurableServletWebServerFactory
Adds mime-type mappings.- 指定者:
addMimeMappings
在接口中ConfigurableServletWebServerFactory
- 参数:
mimeMappings
- the mime type mappings to add
-
getDocumentRoot
Returns the document root which will be used by the web context to serve static files.- 返回:
- the document root
-
setDocumentRoot
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the document root directory which will be used by the web context to serve static files.- 指定者:
setDocumentRoot
在接口中ConfigurableServletWebServerFactory
- 参数:
documentRoot
- the document root ornull
if not required
-
setInitializers
从接口复制的说明:ConfigurableServletWebServerFactory
SetsServletContextInitializer
that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.- 指定者:
setInitializers
在接口中ConfigurableServletWebServerFactory
- 参数:
initializers
- the initializers to set- 另请参阅:
-
addInitializers
从接口复制的说明:ConfigurableServletWebServerFactory
AddServletContextInitializer
s to those that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.- 指定者:
addInitializers
在接口中ConfigurableServletWebServerFactory
- 参数:
initializers
- the initializers to add- 另请参阅:
-
getJsp
-
setJsp
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the configuration that will be applied to the server's JSP servlet.- 指定者:
setJsp
在接口中ConfigurableServletWebServerFactory
- 参数:
jsp
- the JSP servlet configuration
-
getSession
-
setSession
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the configuration that will be applied to the container's HTTP session support.- 指定者:
setSession
在接口中ConfigurableServletWebServerFactory
- 参数:
session
- the session configuration
-
getLocaleCharsetMappings
Return the Locale to Charset mappings.- 返回:
- the charset mappings
-
setLocaleCharsetMappings
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the Locale to Charset mappings.- 指定者:
setLocaleCharsetMappings
在接口中ConfigurableServletWebServerFactory
- 参数:
localeCharsetMappings
- the Locale to Charset mappings
-
setInitParameters
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the init parameters that are applied to the container'sServletContext
.- 指定者:
setInitParameters
在接口中ConfigurableServletWebServerFactory
- 参数:
initParameters
- the init parameters
-
getInitParameters
-
setCookieSameSiteSuppliers
public void setCookieSameSiteSuppliers(List<? extends CookieSameSiteSupplier> cookieSameSiteSuppliers) 从接口复制的说明:ConfigurableServletWebServerFactory
SetsCookieSameSiteSuppliers
that should be used to obtain theCookie.SameSite
attribute of any added cookie. This method will replace any previously set or added suppliers.- 指定者:
setCookieSameSiteSuppliers
在接口中ConfigurableServletWebServerFactory
- 参数:
cookieSameSiteSuppliers
- the suppliers to add- 另请参阅:
-
addCookieSameSiteSuppliers
从接口复制的说明:ConfigurableServletWebServerFactory
AddCookieSameSiteSuppliers
to those that should be used to obtain theCookie.SameSite
attribute of any added cookie.- 指定者:
addCookieSameSiteSuppliers
在接口中ConfigurableServletWebServerFactory
- 参数:
cookieSameSiteSuppliers
- the suppliers to add- 另请参阅:
-
getCookieSameSiteSuppliers
-
mergeInitializers
protected final ServletContextInitializer[] mergeInitializers(ServletContextInitializer... initializers) Utility method that can be used by subclasses wishing to combine the specifiedServletContextInitializer
parameters with those defined in this instance.- 参数:
initializers
- the initializers to merge- 返回:
- a complete set of merged initializers (with the specified parameters appearing first)
-
shouldRegisterJspServlet
protected boolean shouldRegisterJspServlet()Returns whether the JSP servlet should be registered with the web server.- 返回:
true
if the servlet should be registered, otherwisefalse
-
getValidDocumentRoot
Returns the absolute document root when it points to a valid directory, logging a warning and returningnull
otherwise.- 返回:
- the valid document root
-
getUrlsOfJarsWithMetaInfResources
-
getValidSessionStoreDir
-
getValidSessionStoreDir
-
addWebListeners
从接口复制的说明:WebListenerRegistry
Adds web listeners that will be registered with the servlet container.- 指定者:
addWebListeners
在接口中WebListenerRegistry
- 参数:
webListenerClassNames
- the class names of the web listeners
-
getWebListenerClassNames
-