类 TomcatEmbeddedServletContainerFactory
- java.lang.Object
- org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer
- org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
- org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,ConfigurableEmbeddedServletContainer
,EmbeddedServletContainerFactory
,ErrorPageRegistry
,org.springframework.context.ResourceLoaderAware
public class TomcatEmbeddedServletContainerFactory extends AbstractEmbeddedServletContainerFactory implements org.springframework.context.ResourceLoaderAware
EmbeddedServletContainerFactory
that can be used to createTomcatEmbeddedServletContainer
s. Can be initialized using Spring'sServletContextInitializer
s or TomcatLifecycleListener
s.Unless explicitly configured otherwise this factory will created containers that listens for HTTP requests on port 8080.
字段概要
字段 修饰符和类型 字段 说明 static String
DEFAULT_PROTOCOL
The class name of default protocol used.从类继承的字段 org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
logger
构造器概要
构造器 构造器 说明 TomcatEmbeddedServletContainerFactory()
Create a newTomcatEmbeddedServletContainerFactory
instance.TomcatEmbeddedServletContainerFactory(int port)
Create a newTomcatEmbeddedServletContainerFactory
that listens for requests using the specified port.TomcatEmbeddedServletContainerFactory(String contextPath, int port)
Create a newTomcatEmbeddedServletContainerFactory
with the specified context path and port.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)
AddConnector
s in addition to the default connector, e.g. for SSL or AJPvoid
addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers)
AddTomcatContextCustomizer
s that should be added to the TomcatConnector
.void
addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)
AddTomcatContextCustomizer
s that should be added to the TomcatContext
.void
addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)
AddLifecycleListener
s that should be added to the TomcatContext
.void
addContextValves(org.apache.catalina.Valve... contextValves)
AddValve
s that should be applied to the TomcatContext
.void
addEngineValves(org.apache.catalina.Valve... engineValves)
AddValve
s that should be applied to the TomcatEngine
.void
addTldSkipPatterns(String... patterns)
Add patterns that match jars to ignore for TLD scanning.protected void
configureContext(org.apache.catalina.Context context, ServletContextInitializer[] initializers)
Configure the TomcatContext
.protected void
configureSsl(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol, Ssl ssl)
Configure Tomcat'sAbstractHttp11JsseProtocol
for SSL.protected void
configureSslStoreProvider(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol, SslStoreProvider sslStoreProvider)
protected void
customizeConnector(org.apache.catalina.connector.Connector connector)
List<org.apache.catalina.connector.Connector>
getAdditionalTomcatConnectors()
Returns a mutable collection of theConnector
s that will be added to the Tomcat.Collection<org.apache.catalina.LifecycleListener>
getContextLifecycleListeners()
Returns a mutable collection of theLifecycleListener
s that will be applied to the TomcatContext
.Collection<org.apache.catalina.Valve>
getContextValves()
Returns a mutable collection of theValve
s that will be applied to the TomcatContext
.EmbeddedServletContainer
getEmbeddedServletContainer(ServletContextInitializer... initializers)
Gets a new fully configured but pausedEmbeddedServletContainer
instance.Collection<org.apache.catalina.Valve>
getEngineValves()
Returns a mutable collection of theValve
s that will be applied to the TomcatEngine
.Set<String>
getTldSkipPatterns()
Returns a mutable set of the patterns that match jars to ignore for TLD scanning.Collection<TomcatConnectorCustomizer>
getTomcatConnectorCustomizers()
Returns a mutable collection of theTomcatConnectorCustomizer
s that will be applied to the TomcatContext
.Collection<TomcatContextCustomizer>
getTomcatContextCustomizers()
Returns a mutable collection of theTomcatContextCustomizer
s that will be applied to the TomcatContext
.protected TomcatEmbeddedServletContainer
getTomcatEmbeddedServletContainer(org.apache.catalina.startup.Tomcat tomcat)
Factory method called to create theTomcatEmbeddedServletContainer
.Charset
getUriEncoding()
Returns the character encoding to use for URL decoding.protected void
postProcessContext(org.apache.catalina.Context context)
Post process the TomcatContext
before it used with the Tomcat Server.protected void
prepareContext(org.apache.catalina.Host host, ServletContextInitializer[] initializers)
void
setBackgroundProcessorDelay(int delay)
Sets the background processor delay in seconds.void
setBaseDirectory(File baseDirectory)
Set the Tomcat base directory.void
setContextLifecycleListeners(Collection<? extends org.apache.catalina.LifecycleListener> contextLifecycleListeners)
SetLifecycleListener
s that should be applied to the TomcatContext
.void
setContextValves(Collection<? extends org.apache.catalina.Valve> contextValves)
SetValve
s that should be applied to the TomcatContext
.void
setEngineValves(Collection<? extends org.apache.catalina.Valve> engineValves)
SetValve
s that should be applied to the TomcatEngine
.void
setProtocol(String protocol)
The Tomcat protocol to use when create theConnector
.void
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
void
setTldSkip(String tldSkip)
已过时。as of 1.5 in favor ofsetTldSkipPatterns(Collection)
void
setTldSkipPatterns(Collection<String> patterns)
Set the patterns that match jars to ignore for TLD scanning.void
setTomcatConnectorCustomizers(Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)
SetTomcatConnectorCustomizer
s that should be applied to the TomcatConnector
.void
setTomcatContextCustomizers(Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)
SetTomcatContextCustomizer
s that should be applied to the TomcatContext
.void
setUriEncoding(Charset uriEncoding)
Set the character encoding to use for URL decoding.从类继承的方法 org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory
createTempDir, getUrlsOfJarsWithMetaInfResources, getValidDocumentRoot, getValidSessionStoreDir, getValidSessionStoreDir
从类继承的方法 org.springframework.boot.context.embedded.AbstractConfigurableEmbeddedServletContainer
addErrorPages, addInitializers, getAddress, getCompression, getContextPath, getDisplayName, getDocumentRoot, getErrorPages, getJspServlet, getLocaleCharsetMappings, getMimeMappings, getPort, getServerHeader, getSessionStoreDir, getSessionTimeout, getSsl, getSslStoreProvider, isPersistSession, isRegisterDefaultServlet, mergeInitializers, setAddress, setCompression, setContextPath, setDisplayName, setDocumentRoot, setErrorPages, setInitializers, setJspServlet, setLocaleCharsetMappings, setMimeMappings, setPersistSession, setPort, setRegisterDefaultServlet, setServerHeader, setSessionStoreDir, setSessionTimeout, setSessionTimeout, setSsl, setSslStoreProvider, shouldRegisterJspServlet
字段详细资料
DEFAULT_PROTOCOL
public static final String DEFAULT_PROTOCOL
The class name of default protocol used.- 另请参阅:
- 常量字段值
构造器详细资料
TomcatEmbeddedServletContainerFactory
public TomcatEmbeddedServletContainerFactory()
Create a newTomcatEmbeddedServletContainerFactory
instance.
TomcatEmbeddedServletContainerFactory
public TomcatEmbeddedServletContainerFactory(int port)
Create a newTomcatEmbeddedServletContainerFactory
that listens for requests using the specified port.- 参数:
port
- the port to listen on
TomcatEmbeddedServletContainerFactory
public TomcatEmbeddedServletContainerFactory(String contextPath, int port)
Create a newTomcatEmbeddedServletContainerFactory
with the specified context path and port.- 参数:
contextPath
- the root context pathport
- the port to listen on
方法详细资料
getEmbeddedServletContainer
public EmbeddedServletContainer getEmbeddedServletContainer(ServletContextInitializer... initializers)
从接口复制的说明:EmbeddedServletContainerFactory
Gets a new fully configured but pausedEmbeddedServletContainer
instance. Clients should not be able to connect to the returned server untilEmbeddedServletContainer.start()
is called (which happens when theApplicationContext
has been fully refreshed).- 指定者:
getEmbeddedServletContainer
在接口中EmbeddedServletContainerFactory
- 参数:
initializers
-ServletContextInitializer
s that should be applied as the container starts- 返回:
- a fully configured and started
EmbeddedServletContainer
- 另请参阅:
EmbeddedServletContainer.stop()
prepareContext
protected void prepareContext(org.apache.catalina.Host host, ServletContextInitializer[] initializers)
customizeConnector
protected void customizeConnector(org.apache.catalina.connector.Connector connector)
configureSsl
protected void configureSsl(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol, Ssl ssl)
Configure Tomcat'sAbstractHttp11JsseProtocol
for SSL.- 参数:
protocol
- the protocolssl
- the ssl details
configureSslStoreProvider
protected void configureSslStoreProvider(org.apache.coyote.http11.AbstractHttp11JsseProtocol<?> protocol, SslStoreProvider sslStoreProvider)
configureContext
protected void configureContext(org.apache.catalina.Context context, ServletContextInitializer[] initializers)
Configure the TomcatContext
.- 参数:
context
- the Tomcat contextinitializers
- initializers to apply
postProcessContext
protected void postProcessContext(org.apache.catalina.Context context)
Post process the TomcatContext
before it used with the Tomcat Server. Subclasses can override this method to apply additional processing to theContext
.- 参数:
context
- the TomcatContext
getTomcatEmbeddedServletContainer
protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(org.apache.catalina.startup.Tomcat tomcat)
Factory method called to create theTomcatEmbeddedServletContainer
. Subclasses can override this method to return a differentTomcatEmbeddedServletContainer
or apply additional processing to the Tomcat server.- 参数:
tomcat
- the Tomcat server.- 返回:
- a new
TomcatEmbeddedServletContainer
instance
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
- 指定者:
setResourceLoader
在接口中org.springframework.context.ResourceLoaderAware
setBaseDirectory
public void setBaseDirectory(File baseDirectory)
Set the Tomcat base directory. If not specified a temporary directory will be used.- 参数:
baseDirectory
- the tomcat base directory
setTldSkip
@Deprecated public void setTldSkip(String tldSkip)
已过时。as of 1.5 in favor ofsetTldSkipPatterns(Collection)
A comma-separated list of jars to ignore for TLD scanning. See Tomcat's catalina.properties for typical values. Defaults to a list drawn from that source.- 参数:
tldSkip
- the jars to skip when scanning for TLDs etc
getTldSkipPatterns
public Set<String> getTldSkipPatterns()
Returns a mutable set of the patterns that match jars to ignore for TLD scanning.- 返回:
- the list of jars to ignore for TLD scanning
setTldSkipPatterns
public void setTldSkipPatterns(Collection<String> patterns)
Set the patterns that match jars to ignore for TLD scanning. See Tomcat's catalina.properties for typical values. Defaults to a list drawn from that source.- 参数:
patterns
- the jar patterns to skip when scanning for TLDs etc
addTldSkipPatterns
public void addTldSkipPatterns(String... patterns)
Add patterns that match jars to ignore for TLD scanning. See Tomcat's catalina.properties for typical values.- 参数:
patterns
- the additional jar patterns to skip when scanning for TLDs etc
setProtocol
public void setProtocol(String protocol)
The Tomcat protocol to use when create theConnector
.- 参数:
protocol
- the protocol- 另请参阅:
Connector(String)
setEngineValves
public void setEngineValves(Collection<? extends org.apache.catalina.Valve> engineValves)
SetValve
s that should be applied to the TomcatEngine
. Calling this method will replace any existing valves.- 参数:
engineValves
- the valves to set
getEngineValves
public Collection<org.apache.catalina.Valve> getEngineValves()
Returns a mutable collection of theValve
s that will be applied to the TomcatEngine
.- 返回:
- the engineValves the valves that will be applied
addEngineValves
public void addEngineValves(org.apache.catalina.Valve... engineValves)
AddValve
s that should be applied to the TomcatEngine
.- 参数:
engineValves
- the valves to add
setContextValves
public void setContextValves(Collection<? extends org.apache.catalina.Valve> contextValves)
SetValve
s that should be applied to the TomcatContext
. Calling this method will replace any existing valves.- 参数:
contextValves
- the valves to set
getContextValves
public Collection<org.apache.catalina.Valve> getContextValves()
Returns a mutable collection of theValve
s that will be applied to the TomcatContext
.- 返回:
- the contextValves the valves that will be applied
- 另请参阅:
getEngineValves()
addContextValves
public void addContextValves(org.apache.catalina.Valve... contextValves)
AddValve
s that should be applied to the TomcatContext
.- 参数:
contextValves
- the valves to add
setContextLifecycleListeners
public void setContextLifecycleListeners(Collection<? extends org.apache.catalina.LifecycleListener> contextLifecycleListeners)
SetLifecycleListener
s that should be applied to the TomcatContext
. Calling this method will replace any existing listeners.- 参数:
contextLifecycleListeners
- the listeners to set
getContextLifecycleListeners
public Collection<org.apache.catalina.LifecycleListener> getContextLifecycleListeners()
Returns a mutable collection of theLifecycleListener
s that will be applied to the TomcatContext
.- 返回:
- the contextLifecycleListeners the listeners that will be applied
addContextLifecycleListeners
public void addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)
AddLifecycleListener
s that should be added to the TomcatContext
.- 参数:
contextLifecycleListeners
- the listeners to add
setTomcatContextCustomizers
public void setTomcatContextCustomizers(Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)
SetTomcatContextCustomizer
s that should be applied to the TomcatContext
. Calling this method will replace any existing customizers.- 参数:
tomcatContextCustomizers
- the customizers to set
getTomcatContextCustomizers
public Collection<TomcatContextCustomizer> getTomcatContextCustomizers()
Returns a mutable collection of theTomcatContextCustomizer
s that will be applied to the TomcatContext
.- 返回:
- the listeners that will be applied
addContextCustomizers
public void addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)
AddTomcatContextCustomizer
s that should be added to the TomcatContext
.- 参数:
tomcatContextCustomizers
- the customizers to add
setTomcatConnectorCustomizers
public void setTomcatConnectorCustomizers(Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)
SetTomcatConnectorCustomizer
s that should be applied to the TomcatConnector
. Calling this method will replace any existing customizers.- 参数:
tomcatConnectorCustomizers
- the customizers to set
addConnectorCustomizers
public void addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers)
AddTomcatContextCustomizer
s that should be added to the TomcatConnector
.- 参数:
tomcatConnectorCustomizers
- the customizers to add
getTomcatConnectorCustomizers
public Collection<TomcatConnectorCustomizer> getTomcatConnectorCustomizers()
Returns a mutable collection of theTomcatConnectorCustomizer
s that will be applied to the TomcatContext
.- 返回:
- the listeners that will be applied
addAdditionalTomcatConnectors
public void addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)
AddConnector
s in addition to the default connector, e.g. for SSL or AJP- 参数:
connectors
- the connectors to add
getAdditionalTomcatConnectors
public List<org.apache.catalina.connector.Connector> getAdditionalTomcatConnectors()
Returns a mutable collection of theConnector
s that will be added to the Tomcat.- 返回:
- the additionalTomcatConnectors
setUriEncoding
public void setUriEncoding(Charset uriEncoding)
Set the character encoding to use for URL decoding. If not specified 'UTF-8' will be used.- 参数:
uriEncoding
- the uri encoding to set
getUriEncoding
public Charset getUriEncoding()
Returns the character encoding to use for URL decoding.- 返回:
- the URI encoding
setBackgroundProcessorDelay
public void setBackgroundProcessorDelay(int delay)
Sets the background processor delay in seconds.- 参数:
delay
- the delay in seconds- 从以下版本开始:
- 1.4.1