public class TomcatServletWebServerFactory extends AbstractServletWebServerFactory implements ConfigurableTomcatWebServerFactory, org.springframework.context.ResourceLoaderAware
AbstractServletWebServerFactory that can be used to create
 TomcatWebServers. Can be initialized using Spring's
 ServletContextInitializers or Tomcat LifecycleListeners.
 Unless explicitly configured otherwise this factory will create containers that listen for HTTP requests on port 8080.
AbstractConfigurableWebServerFactory.setPort(int), 
setContextLifecycleListeners(Collection), 
TomcatWebServer| Modifier and Type | Field and Description | 
|---|---|
| static String | DEFAULT_PROTOCOLThe class name of default protocol used. | 
logger| Constructor and Description | 
|---|
| TomcatServletWebServerFactory()Create a new  TomcatServletWebServerFactoryinstance. | 
| TomcatServletWebServerFactory(int port)Create a new  TomcatServletWebServerFactorythat listens for requests using
 the specified port. | 
| TomcatServletWebServerFactory(String contextPath,
                             int port)Create a new  TomcatServletWebServerFactorywith the specified context path
 and port. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)Add  Connectors in addition to the default connector, e.g. | 
| void | addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers)Add  TomcatConnectorCustomizers that should be added to the TomcatConnector. | 
| void | addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)Add  TomcatContextCustomizers that should be added to the TomcatContext. | 
| void | addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)Add  LifecycleListeners that should be added to the TomcatContext. | 
| void | addContextValves(org.apache.catalina.Valve... contextValves)Add  Valves that should be applied to the TomcatContext. | 
| void | addEngineValves(org.apache.catalina.Valve... engineValves)Add  Valves 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 Tomcat  Context. | 
| protected void | customizeConnector(org.apache.catalina.connector.Connector connector) | 
| List<org.apache.catalina.connector.Connector> | getAdditionalTomcatConnectors()Returns a mutable collection of the  Connectors that will be added to the
 Tomcat. | 
| Collection<org.apache.catalina.LifecycleListener> | getContextLifecycleListeners()Returns a mutable collection of the  LifecycleListeners that will be applied
 to the TomcatContext. | 
| Collection<org.apache.catalina.Valve> | getContextValves()Returns a mutable collection of the  Valves that will be applied to the
 TomcatContext. | 
| Collection<org.apache.catalina.Valve> | getEngineValves()Returns a mutable collection of the  Valves 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 the  TomcatConnectorCustomizers that will be
 applied to the TomcatConnector. | 
| Collection<TomcatContextCustomizer> | getTomcatContextCustomizers()Returns a mutable collection of the  TomcatContextCustomizers that will be
 applied to the TomcatContext. | 
| protected TomcatWebServer | getTomcatWebServer(org.apache.catalina.startup.Tomcat tomcat)Factory method called to create the  TomcatWebServer. | 
| Charset | getUriEncoding()Returns the character encoding to use for URL decoding. | 
| WebServer | getWebServer(ServletContextInitializer... initializers)Gets a new fully configured but paused  WebServerinstance. | 
| protected void | postProcessContext(org.apache.catalina.Context context)Post process the Tomcat  Contextbefore it's 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)Set  LifecycleListeners that should be applied to the TomcatContext. | 
| void | setContextValves(Collection<? extends org.apache.catalina.Valve> contextValves)Set  Valves that should be applied to the TomcatContext. | 
| void | setEngineValves(Collection<? extends org.apache.catalina.Valve> engineValves)Set  Valves that should be applied to the TomcatEngine. | 
| void | setProtocol(String protocol)The Tomcat protocol to use when create the  Connector. | 
| void | setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) | 
| void | setTldSkipPatterns(Collection<String> patterns)Set the patterns that match jars to ignore for TLD scanning. | 
| void | setTomcatConnectorCustomizers(Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)Set  TomcatConnectorCustomizers that should be applied to the TomcatConnector. | 
| void | setTomcatContextCustomizers(Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)Set  TomcatContextCustomizers that should be applied to the TomcatContext. | 
| void | setUriEncoding(Charset uriEncoding)Set the character encoding to use for URL decoding. | 
addInitializers, getContextPath, getDisplayName, getDocumentRoot, getInitParameters, getJsp, getLocaleCharsetMappings, getMimeMappings, getSession, getUrlsOfJarsWithMetaInfResources, getValidDocumentRoot, getValidSessionStoreDir, getValidSessionStoreDir, isRegisterDefaultServlet, mergeInitializers, setContextPath, setDisplayName, setDocumentRoot, setInitializers, setInitParameters, setJsp, setLocaleCharsetMappings, setMimeMappings, setRegisterDefaultServlet, setSession, shouldRegisterJspServletaddErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProviderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProvideraddErrorPagespublic static final String DEFAULT_PROTOCOL
public TomcatServletWebServerFactory()
TomcatServletWebServerFactory instance.public TomcatServletWebServerFactory(int port)
TomcatServletWebServerFactory that listens for requests using
 the specified port.port - the port to listen onpublic TomcatServletWebServerFactory(String contextPath, int port)
TomcatServletWebServerFactory with the specified context path
 and port.contextPath - the root context pathport - the port to listen onpublic WebServer getWebServer(ServletContextInitializer... initializers)
ServletWebServerFactoryWebServer instance. Clients should
 not be able to connect to the returned server until WebServer.start() is
 called (which happens when the ApplicationContext has been fully
 refreshed).getWebServer in interface ServletWebServerFactoryinitializers - ServletContextInitializers that should be applied as
 the server startsWebServerWebServer.stop()protected void prepareContext(org.apache.catalina.Host host,
                              ServletContextInitializer[] initializers)
protected void customizeConnector(org.apache.catalina.connector.Connector connector)
protected void configureContext(org.apache.catalina.Context context,
                                ServletContextInitializer[] initializers)
Context.context - the Tomcat contextinitializers - initializers to applyprotected void postProcessContext(org.apache.catalina.Context context)
Context before it's used with the Tomcat Server.
 Subclasses can override this method to apply additional processing to the
 Context.context - the Tomcat Contextprotected TomcatWebServer getTomcatWebServer(org.apache.catalina.startup.Tomcat tomcat)
TomcatWebServer. Subclasses can
 override this method to return a different TomcatWebServer or apply
 additional processing to the Tomcat server.tomcat - the Tomcat server.TomcatWebServer instancepublic void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader in interface org.springframework.context.ResourceLoaderAwarepublic void setBaseDirectory(File baseDirectory)
ConfigurableTomcatWebServerFactorysetBaseDirectory in interface ConfigurableTomcatWebServerFactorybaseDirectory - the tomcat base directorypublic Set<String> getTldSkipPatterns()
public void setTldSkipPatterns(Collection<String> patterns)
patterns - the jar patterns to skip when scanning for TLDs etcpublic void addTldSkipPatterns(String... patterns)
patterns - the additional jar patterns to skip when scanning for TLDs etcpublic void setProtocol(String protocol)
Connector.protocol - the protocolConnector(String)public void setEngineValves(Collection<? extends org.apache.catalina.Valve> engineValves)
Valves that should be applied to the Tomcat Engine. Calling
 this method will replace any existing valves.engineValves - the valves to setpublic Collection<org.apache.catalina.Valve> getEngineValves()
Valves that will be applied to the
 Tomcat Engine.public void addEngineValves(org.apache.catalina.Valve... engineValves)
ConfigurableTomcatWebServerFactoryValves that should be applied to the Tomcat Engine.addEngineValves in interface ConfigurableTomcatWebServerFactoryengineValves - the valves to addpublic void setContextValves(Collection<? extends org.apache.catalina.Valve> contextValves)
Valves that should be applied to the Tomcat Context. Calling
 this method will replace any existing valves.contextValves - the valves to setpublic Collection<org.apache.catalina.Valve> getContextValves()
Valves that will be applied to the
 Tomcat Context.getEngineValves()public void addContextValves(org.apache.catalina.Valve... contextValves)
Valves that should be applied to the Tomcat Context.contextValves - the valves to addpublic void setContextLifecycleListeners(Collection<? extends org.apache.catalina.LifecycleListener> contextLifecycleListeners)
LifecycleListeners that should be applied to the Tomcat
 Context. Calling this method will replace any existing listeners.contextLifecycleListeners - the listeners to setpublic Collection<org.apache.catalina.LifecycleListener> getContextLifecycleListeners()
LifecycleListeners that will be applied
 to the Tomcat Context.public void addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)
LifecycleListeners that should be added to the Tomcat Context.contextLifecycleListeners - the listeners to addpublic void setTomcatContextCustomizers(Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)
TomcatContextCustomizers that should be applied to the Tomcat
 Context. Calling this method will replace any existing customizers.tomcatContextCustomizers - the customizers to setpublic Collection<TomcatContextCustomizer> getTomcatContextCustomizers()
TomcatContextCustomizers that will be
 applied to the Tomcat Context.public void addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)
ConfigurableTomcatWebServerFactoryTomcatContextCustomizers that should be added to the Tomcat
 Context.addContextCustomizers in interface ConfigurableTomcatWebServerFactorytomcatContextCustomizers - the customizers to addpublic void setTomcatConnectorCustomizers(Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)
TomcatConnectorCustomizers that should be applied to the Tomcat
 Connector. Calling this method will replace any existing customizers.tomcatConnectorCustomizers - the customizers to setpublic void addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers)
ConfigurableTomcatWebServerFactoryTomcatConnectorCustomizers that should be added to the Tomcat
 Connector.addConnectorCustomizers in interface ConfigurableTomcatWebServerFactorytomcatConnectorCustomizers - the customizers to addpublic Collection<TomcatConnectorCustomizer> getTomcatConnectorCustomizers()
TomcatConnectorCustomizers that will be
 applied to the Tomcat Connector.public void addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)
Connectors in addition to the default connector, e.g. for SSL or AJPconnectors - the connectors to addpublic List<org.apache.catalina.connector.Connector> getAdditionalTomcatConnectors()
Connectors that will be added to the
 Tomcat.public void setUriEncoding(Charset uriEncoding)
ConfigurableTomcatWebServerFactorysetUriEncoding in interface ConfigurableTomcatWebServerFactoryuriEncoding - the uri encoding to setpublic Charset getUriEncoding()
public void setBackgroundProcessorDelay(int delay)
ConfigurableTomcatWebServerFactorysetBackgroundProcessorDelay in interface ConfigurableTomcatWebServerFactorydelay - the delay in secondsCopyright © 2020 Pivotal Software, Inc.. All rights reserved.