类 AbstractConfigurableEmbeddedServletContainer
- java.lang.Object
- org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer
public abstract class AbstractConfigurableEmbeddedServletContainer extends Object implements ConfigurableEmbeddedServletContainer
Abstract base class forConfigurableEmbeddedServletContainer
implementations.
构造器概要
构造器 构造器 说明 AbstractConfigurableEmbeddedServletContainer()
Create a newAbstractConfigurableEmbeddedServletContainer
instance.AbstractConfigurableEmbeddedServletContainer(int port)
Create a newAbstractConfigurableEmbeddedServletContainer
instance with the specified port.AbstractConfigurableEmbeddedServletContainer(String contextPath, int port)
Create a newAbstractConfigurableEmbeddedServletContainer
instance with the specified context path and port.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addErrorPages(ErrorPage... errorPages)
Adds error pages that will be used when handling exceptions.void
addInitializers(ServletContextInitializer... initializers)
AddServletContextInitializer
s to those that should be applied in addition toEmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters.InetAddress
getAddress()
Return the address that the embedded container binds to.Compression
getCompression()
String
getContextPath()
Returns the context path for the embedded servlet container.String
getDisplayName()
File
getDocumentRoot()
Returns the document root which will be used by the web context to serve static files.Set<ErrorPage>
getErrorPages()
Returns a mutable set ofErrorPages
that will be used when handling exceptions.JspServlet
getJspServlet()
Map<Locale,Charset>
getLocaleCharsetMappings()
Return the Locale to Charset mappings.MimeMappings
getMimeMappings()
Returns the mime-type mappings.int
getPort()
The port that the embedded server listens on.String
getServerHeader()
File
getSessionStoreDir()
int
getSessionTimeout()
Return the session timeout in seconds.Ssl
getSsl()
SslStoreProvider
getSslStoreProvider()
boolean
isPersistSession()
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
setAddress(InetAddress address)
Sets the specific network address that the server should bind to.void
setCompression(Compression compression)
Sets the compression configuration that will be applied to the container's default connector.void
setContextPath(String contextPath)
Sets the context path for the embedded servlet container.void
setDisplayName(String displayName)
Sets the display name of the application deployed in the embedded servlet container.void
setDocumentRoot(File documentRoot)
Sets the document root directory which will be used by the web context to serve static files.void
setErrorPages(Set<? extends ErrorPage> errorPages)
Sets the error pages that will be used when handling exceptions.void
setInitializers(List<? extends ServletContextInitializer> initializers)
SetsServletContextInitializer
that should be applied in addition toEmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters.void
setJspServlet(JspServlet jspServlet)
Sets the configuration that will be applied to the container'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
setPersistSession(boolean persistSession)
Sets if session data should be persisted between restarts.void
setPort(int port)
Sets the port that the embedded servlet container should listen on.void
setRegisterDefaultServlet(boolean registerDefaultServlet)
Set if the DefaultServlet should be registered.void
setServerHeader(String serverHeader)
Sets the server header value.void
setSessionStoreDir(File sessionStoreDir)
Set the directory used to store serialized session data.void
setSessionTimeout(int sessionTimeout)
The session timeout in seconds (default 30 minutes).void
setSessionTimeout(int sessionTimeout, TimeUnit timeUnit)
The session timeout in the specifiedTimeUnit
(default 30 minutes).void
setSsl(Ssl ssl)
Sets the SSL configuration that will be applied to the container's default connector.void
setSslStoreProvider(SslStoreProvider sslStoreProvider)
Sets a provider that will be used to obtain SSL stores.protected boolean
shouldRegisterJspServlet()
Returns whether or not the JSP servlet should be registered with the embedded container.
构造器详细资料
AbstractConfigurableEmbeddedServletContainer
public AbstractConfigurableEmbeddedServletContainer()
Create a newAbstractConfigurableEmbeddedServletContainer
instance.
AbstractConfigurableEmbeddedServletContainer
public AbstractConfigurableEmbeddedServletContainer(int port)
Create a newAbstractConfigurableEmbeddedServletContainer
instance with the specified port.- 参数:
port
- the port number for the embedded servlet container
AbstractConfigurableEmbeddedServletContainer
public AbstractConfigurableEmbeddedServletContainer(String contextPath, int port)
Create a newAbstractConfigurableEmbeddedServletContainer
instance with the specified context path and port.- 参数:
contextPath
- the context path for the embedded servlet containerport
- the port number for the embedded servlet container
方法详细资料
setContextPath
public void setContextPath(String contextPath)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the context path for the embedded servlet container. 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
在接口中ConfigurableEmbeddedServletContainer
- 参数:
contextPath
- the contextPath to set
getContextPath
public String getContextPath()
Returns the context path for the embedded servlet container. The path will start with "/" and not end with "/". The root context is represented by an empty string.- 返回:
- the context path
setDisplayName
public void setDisplayName(String displayName)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the display name of the application deployed in the embedded servlet container.- 指定者:
setDisplayName
在接口中ConfigurableEmbeddedServletContainer
- 参数:
displayName
- the displayName to set
getDisplayName
public String getDisplayName()
setPort
public void setPort(int port)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the port that the embedded servlet container should listen on. If not specified port '8080' will be used. Use port -1 to disable auto-start (i.e start the web application context but not have it listen to any port).- 指定者:
setPort
在接口中ConfigurableEmbeddedServletContainer
- 参数:
port
- the port to set
getPort
public int getPort()
The port that the embedded server listens on.- 返回:
- the port
setAddress
public void setAddress(InetAddress address)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the specific network address that the server should bind to.- 指定者:
setAddress
在接口中ConfigurableEmbeddedServletContainer
- 参数:
address
- the address to set (defaults tonull
)
getAddress
public InetAddress getAddress()
Return the address that the embedded container binds to.- 返回:
- the address
setSessionTimeout
public void setSessionTimeout(int sessionTimeout)
从接口复制的说明:ConfigurableEmbeddedServletContainer
The session timeout in seconds (default 30 minutes). If 0 or negative then sessions never expire.- 指定者:
setSessionTimeout
在接口中ConfigurableEmbeddedServletContainer
- 参数:
sessionTimeout
- the session timeout
setSessionTimeout
public void setSessionTimeout(int sessionTimeout, TimeUnit timeUnit)
从接口复制的说明:ConfigurableEmbeddedServletContainer
The session timeout in the specifiedTimeUnit
(default 30 minutes). If 0 or negative then sessions never expire.- 指定者:
setSessionTimeout
在接口中ConfigurableEmbeddedServletContainer
- 参数:
sessionTimeout
- the session timeouttimeUnit
- the time unit
getSessionTimeout
public int getSessionTimeout()
Return the session timeout in seconds.- 返回:
- the timeout in seconds
setPersistSession
public void setPersistSession(boolean persistSession)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets if session data should be persisted between restarts.- 指定者:
setPersistSession
在接口中ConfigurableEmbeddedServletContainer
- 参数:
persistSession
-true
if session data should be persisted
isPersistSession
public boolean isPersistSession()
setSessionStoreDir
public void setSessionStoreDir(File sessionStoreDir)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Set the directory used to store serialized session data.- 指定者:
setSessionStoreDir
在接口中ConfigurableEmbeddedServletContainer
- 参数:
sessionStoreDir
- the directory ornull
to use a default location.
getSessionStoreDir
public File getSessionStoreDir()
setInitializers
public void setInitializers(List<? extends ServletContextInitializer> initializers)
从接口复制的说明:ConfigurableEmbeddedServletContainer
SetsServletContextInitializer
that should be applied in addition toEmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters. This method will replace any previously set or added initializers.- 指定者:
setInitializers
在接口中ConfigurableEmbeddedServletContainer
- 参数:
initializers
- the initializers to set- 另请参阅:
ConfigurableEmbeddedServletContainer.addInitializers(org.springframework.boot.web.servlet.ServletContextInitializer...)
addInitializers
public void addInitializers(ServletContextInitializer... initializers)
从接口复制的说明:ConfigurableEmbeddedServletContainer
AddServletContextInitializer
s to those that should be applied in addition toEmbeddedServletContainerFactory.getEmbeddedServletContainer(ServletContextInitializer...)
parameters.- 指定者:
addInitializers
在接口中ConfigurableEmbeddedServletContainer
- 参数:
initializers
- the initializers to add- 另请参阅:
ConfigurableEmbeddedServletContainer.setInitializers(java.util.List<? extends org.springframework.boot.web.servlet.ServletContextInitializer>)
setDocumentRoot
public void setDocumentRoot(File documentRoot)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the document root directory which will be used by the web context to serve static files.- 指定者:
setDocumentRoot
在接口中ConfigurableEmbeddedServletContainer
- 参数:
documentRoot
- the document root ornull
if not required
getDocumentRoot
public File getDocumentRoot()
Returns the document root which will be used by the web context to serve static files.- 返回:
- the document root
setErrorPages
public void setErrorPages(Set<? extends ErrorPage> errorPages)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the error pages that will be used when handling exceptions.- 指定者:
setErrorPages
在接口中ConfigurableEmbeddedServletContainer
- 参数:
errorPages
- the error pages
addErrorPages
public void addErrorPages(ErrorPage... errorPages)
从接口复制的说明:ErrorPageRegistry
Adds error pages that will be used when handling exceptions.- 指定者:
addErrorPages
在接口中ErrorPageRegistry
- 参数:
errorPages
- the error pages
getErrorPages
public Set<ErrorPage> getErrorPages()
Returns a mutable set ofErrorPages
that will be used when handling exceptions.- 返回:
- the error pages
setMimeMappings
public void setMimeMappings(MimeMappings mimeMappings)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the mime-type mappings.- 指定者:
setMimeMappings
在接口中ConfigurableEmbeddedServletContainer
- 参数:
mimeMappings
- the mime type mappings (defaults toMimeMappings.DEFAULT
)
getMimeMappings
public MimeMappings getMimeMappings()
Returns the mime-type mappings.- 返回:
- the mimeMappings the mime-type mappings.
setRegisterDefaultServlet
public void setRegisterDefaultServlet(boolean registerDefaultServlet)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Set if the DefaultServlet should be registered. Defaults totrue
so that files from thedocument root
will be served.- 指定者:
setRegisterDefaultServlet
在接口中ConfigurableEmbeddedServletContainer
- 参数:
registerDefaultServlet
- if the default servlet should be registered
isRegisterDefaultServlet
public boolean isRegisterDefaultServlet()
Flag to indicate that the default servlet should be registered.- 返回:
- true if the default servlet is to be registered
setSsl
public void setSsl(Ssl ssl)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the SSL configuration that will be applied to the container's default connector.- 指定者:
setSsl
在接口中ConfigurableEmbeddedServletContainer
- 参数:
ssl
- the SSL configuration
setSslStoreProvider
public void setSslStoreProvider(SslStoreProvider sslStoreProvider)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets a provider that will be used to obtain SSL stores.- 指定者:
setSslStoreProvider
在接口中ConfigurableEmbeddedServletContainer
- 参数:
sslStoreProvider
- the SSL store provider
getSslStoreProvider
public SslStoreProvider getSslStoreProvider()
setJspServlet
public void setJspServlet(JspServlet jspServlet)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the configuration that will be applied to the container's JSP servlet.- 指定者:
setJspServlet
在接口中ConfigurableEmbeddedServletContainer
- 参数:
jspServlet
- the JSP servlet configuration
getJspServlet
public JspServlet getJspServlet()
getCompression
public Compression getCompression()
setCompression
public void setCompression(Compression compression)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the compression configuration that will be applied to the container's default connector.- 指定者:
setCompression
在接口中ConfigurableEmbeddedServletContainer
- 参数:
compression
- the compression configuration
getServerHeader
public String getServerHeader()
setServerHeader
public void setServerHeader(String serverHeader)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the server header value.- 指定者:
setServerHeader
在接口中ConfigurableEmbeddedServletContainer
- 参数:
serverHeader
- the server header value
getLocaleCharsetMappings
public Map<Locale,Charset> getLocaleCharsetMappings()
Return the Locale to Charset mappings.- 返回:
- the charset mappings
setLocaleCharsetMappings
public void setLocaleCharsetMappings(Map<Locale,Charset> localeCharsetMappings)
从接口复制的说明:ConfigurableEmbeddedServletContainer
Sets the Locale to Charset mappings.- 指定者:
setLocaleCharsetMappings
在接口中ConfigurableEmbeddedServletContainer
- 参数:
localeCharsetMappings
- the Locale to Charset mappings
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 embedded container.- 返回:
true
if the container should be registered, otherwisefalse