类 AbstractServletWebServerFactory
- java.lang.Object
- org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
- org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory
- 所有已实现的接口:
ConfigurableWebServerFactory
,ErrorPageRegistry
,WebServerFactory
,ConfigurableServletWebServerFactory
,ServletWebServerFactory
public abstract class AbstractServletWebServerFactory extends AbstractConfigurableWebServerFactory implements ConfigurableServletWebServerFactory
Abstract base class forConfigurableServletWebServerFactory
implementations.- 从以下版本开始:
- 2.0.0
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Log
logger
构造器概要
构造器 构造器 说明 AbstractServletWebServerFactory()
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
addInitializers(ServletContextInitializer... initializers)
AddServletContextInitializer
s to those that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.String
getContextPath()
Returns the context path for the web server.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 returningnull
otherwise.protected File
getValidSessionStoreDir()
protected File
getValidSessionStoreDir(boolean mkdirs)
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 specifiedServletContextInitializer
parameters with those defined in this instance.void
setContextPath(String contextPath)
Sets the context path for the web server.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
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.从类继承的方法 org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProvider
从类继承的方法 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, setSsl, setSslStoreProvider
从接口继承的方法 org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
从接口继承的方法 org.springframework.boot.web.servlet.server.ServletWebServerFactory
getWebServer
字段详细资料
logger
protected final org.apache.commons.logging.Log 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
public AbstractServletWebServerFactory(String contextPath, int port)
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
public String 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
public void setContextPath(String contextPath)
从接口复制的说明: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
public String getDisplayName()
setDisplayName
public void setDisplayName(String displayName)
从接口复制的说明: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 totrue
so that files from thedocument root
will be served.- 指定者:
setRegisterDefaultServlet
在接口中ConfigurableServletWebServerFactory
- 参数:
registerDefaultServlet
- if the default servlet should be registered
getMimeMappings
public MimeMappings getMimeMappings()
Returns the mime-type mappings.- 返回:
- the mimeMappings the mime-type mappings.
setMimeMappings
public void setMimeMappings(MimeMappings mimeMappings)
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the mime-type mappings.- 指定者:
setMimeMappings
在接口中ConfigurableServletWebServerFactory
- 参数:
mimeMappings
- the mime type mappings (defaults toMimeMappings.DEFAULT
)
getDocumentRoot
public File getDocumentRoot()
Returns the document root which will be used by the web context to serve static files.- 返回:
- the document root
setDocumentRoot
public void setDocumentRoot(File documentRoot)
从接口复制的说明: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
public void setInitializers(List<? extends ServletContextInitializer> initializers)
从接口复制的说明: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- 另请参阅:
ConfigurableServletWebServerFactory.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)
addInitializers
public void addInitializers(ServletContextInitializer... initializers)
从接口复制的说明:ConfigurableServletWebServerFactory
AddServletContextInitializer
s to those that should be applied in addition toServletWebServerFactory.getWebServer(ServletContextInitializer...)
parameters.- 指定者:
addInitializers
在接口中ConfigurableServletWebServerFactory
- 参数:
initializers
- the initializers to add- 另请参阅:
ConfigurableServletWebServerFactory.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)
setJsp
public void setJsp(Jsp jsp)
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the configuration that will be applied to the server's JSP servlet.- 指定者:
setJsp
在接口中ConfigurableServletWebServerFactory
- 参数:
jsp
- the JSP servlet configuration
getSession
public Session getSession()
setSession
public void setSession(Session session)
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the configuration that will be applied to the container's HTTP session support.- 指定者:
setSession
在接口中ConfigurableServletWebServerFactory
- 参数:
session
- the session configuration
getLocaleCharsetMappings
public Map<Locale,Charset> getLocaleCharsetMappings()
Return the Locale to Charset mappings.- 返回:
- the charset mappings
setLocaleCharsetMappings
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the Locale to Charset mappings.- 指定者:
setLocaleCharsetMappings
在接口中ConfigurableServletWebServerFactory
- 参数:
localeCharsetMappings
- the Locale to Charset mappings
setInitParameters
public void setInitParameters(Map<String,String> initParameters)
从接口复制的说明:ConfigurableServletWebServerFactory
Sets the init parameters that are applied to the container'sServletContext
.- 指定者:
setInitParameters
在接口中ConfigurableServletWebServerFactory
- 参数:
initParameters
- the init parameters
getInitParameters
public Map<String,String> getInitParameters()
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 or not the JSP servlet should be registered with the web server.- 返回:
true
if the servlet should be registered, otherwisefalse
getValidDocumentRoot
protected final File getValidDocumentRoot()
Returns the absolute document root when it points to a valid directory, logging a warning and returningnull
otherwise.- 返回:
- the valid document root
getUrlsOfJarsWithMetaInfResources
protected final List<URL> getUrlsOfJarsWithMetaInfResources()
getValidSessionStoreDir
protected final File getValidSessionStoreDir()
getValidSessionStoreDir
protected final File getValidSessionStoreDir(boolean mkdirs)