public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFactory implements ConfigurableTomcatWebServerFactory
ReactiveWebServerFactory
that can be used to create a TomcatWebServer
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_PROTOCOL
The class name of default protocol used.
|
Constructor and Description |
---|
TomcatReactiveWebServerFactory()
Create a new
TomcatReactiveWebServerFactory instance. |
TomcatReactiveWebServerFactory(int port)
Create a new
TomcatReactiveWebServerFactory that listens for requests using
the specified port. |
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)
Add
Connector s in addition to the default connector, e.g. |
void |
addConnectorCustomizers(TomcatConnectorCustomizer... tomcatConnectorCustomizers)
Add
TomcatConnectorCustomizer s that should be added to the Tomcat
Connector . |
void |
addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)
Add
TomcatContextCustomizer s that should be added to the Tomcat
Context . |
void |
addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)
Add
LifecycleListener s that should be added to the Tomcat Context . |
void |
addEngineValves(org.apache.catalina.Valve... engineValves)
Add
Valve s that should be applied to the Tomcat Engine . |
void |
addProtocolHandlerCustomizers(TomcatProtocolHandlerCustomizer<?>... tomcatProtocolHandlerCustomizers)
Add
TomcatProtocolHandlerCustomizer s that should be added to the Tomcat
Connector . |
protected void |
configureContext(org.apache.catalina.Context context)
Configure the Tomcat
Context . |
protected void |
customizeConnector(org.apache.catalina.connector.Connector connector) |
java.util.List<org.apache.catalina.connector.Connector> |
getAdditionalTomcatConnectors()
Returns a mutable collection of the
Connector s that will be added to the
Tomcat. |
java.util.Collection<org.apache.catalina.LifecycleListener> |
getContextLifecycleListeners()
Returns a mutable collection of the
LifecycleListener s that will be applied
to the Tomcat Context . |
java.util.List<org.apache.catalina.Valve> |
getEngineValves()
Returns a mutable collection of the
Valve s that will be applied to the
Tomcat Engine . |
java.util.Collection<TomcatConnectorCustomizer> |
getTomcatConnectorCustomizers()
Returns a mutable collection of the
TomcatConnectorCustomizer s that will be
applied to the Tomcat Connector . |
java.util.Collection<TomcatContextCustomizer> |
getTomcatContextCustomizers()
Returns a mutable collection of the
TomcatContextCustomizer s that will be
applied to the Tomcat Context . |
java.util.Collection<TomcatProtocolHandlerCustomizer<?>> |
getTomcatProtocolHandlerCustomizers()
Returns a mutable collection of the
TomcatProtocolHandlerCustomizer s that
will be applied to the Tomcat Connector . |
protected TomcatWebServer |
getTomcatWebServer(org.apache.catalina.startup.Tomcat tomcat)
Factory method called to create the
TomcatWebServer . |
java.nio.charset.Charset |
getUriEncoding()
Returns the character encoding to use for URL decoding.
|
WebServer |
getWebServer(org.springframework.http.server.reactive.HttpHandler httpHandler)
Gets a new fully configured but paused
WebServer instance. |
protected void |
prepareContext(org.apache.catalina.Host host,
org.springframework.http.server.reactive.TomcatHttpHandlerAdapter servlet) |
void |
setBackgroundProcessorDelay(int delay)
Sets the background processor delay in seconds.
|
void |
setBaseDirectory(java.io.File baseDirectory)
Set the Tomcat base directory.
|
void |
setContextLifecycleListeners(java.util.Collection<? extends org.apache.catalina.LifecycleListener> contextLifecycleListeners)
Set
LifecycleListener s that should be applied to the Tomcat
Context . |
void |
setDisableMBeanRegistry(boolean disableMBeanRegistry)
Set whether the factory should disable Tomcat's MBean registry prior to creating
the server.
|
void |
setProtocol(java.lang.String protocol)
The Tomcat protocol to use when create the
Connector . |
void |
setTomcatConnectorCustomizers(java.util.Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)
Set
TomcatConnectorCustomizer s that should be applied to the Tomcat
Connector . |
void |
setTomcatContextCustomizers(java.util.Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)
Set
TomcatContextCustomizer s that should be applied to the Tomcat
Context . |
void |
setTomcatProtocolHandlerCustomizers(java.util.Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers)
Set
TomcatProtocolHandlerCustomizer s that should be applied to the Tomcat
Connector . |
void |
setUriEncoding(java.nio.charset.Charset uriEncoding)
Set the character encoding to use for URL decoding.
|
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getOrCreateSslStoreProvider, getPort, getServerHeader, getShutdown, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslStoreProvider
addErrorPages
public static final java.lang.String DEFAULT_PROTOCOL
public TomcatReactiveWebServerFactory()
TomcatReactiveWebServerFactory
instance.public TomcatReactiveWebServerFactory(int port)
TomcatReactiveWebServerFactory
that listens for requests using
the specified port.port
- the port to listen onpublic WebServer getWebServer(org.springframework.http.server.reactive.HttpHandler httpHandler)
ReactiveWebServerFactory
WebServer
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 ReactiveWebServerFactory
httpHandler
- the HTTP handler in charge of processing requestsWebServer
WebServer.stop()
protected void prepareContext(org.apache.catalina.Host host, org.springframework.http.server.reactive.TomcatHttpHandlerAdapter servlet)
protected void configureContext(org.apache.catalina.Context context)
Context
.context
- the Tomcat contextprotected void customizeConnector(org.apache.catalina.connector.Connector connector)
public void setBaseDirectory(java.io.File baseDirectory)
ConfigurableTomcatWebServerFactory
setBaseDirectory
in interface ConfigurableTomcatWebServerFactory
baseDirectory
- the tomcat base directorypublic void setBackgroundProcessorDelay(int delay)
ConfigurableTomcatWebServerFactory
setBackgroundProcessorDelay
in interface ConfigurableTomcatWebServerFactory
delay
- the delay in secondspublic void setTomcatContextCustomizers(java.util.Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers)
TomcatContextCustomizer
s that should be applied to the Tomcat
Context
. Calling this method will replace any existing customizers.tomcatContextCustomizers
- the customizers to setpublic java.util.Collection<TomcatContextCustomizer> getTomcatContextCustomizers()
TomcatContextCustomizer
s that will be
applied to the Tomcat Context
.public void addContextCustomizers(TomcatContextCustomizer... tomcatContextCustomizers)
TomcatContextCustomizer
s that should be added to the Tomcat
Context
.addContextCustomizers
in interface ConfigurableTomcatWebServerFactory
tomcatContextCustomizers
- the customizers to addpublic void setTomcatConnectorCustomizers(java.util.Collection<? extends TomcatConnectorCustomizer> tomcatConnectorCustomizers)
TomcatConnectorCustomizer
s 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)
TomcatConnectorCustomizer
s that should be added to the Tomcat
Connector
.addConnectorCustomizers
in interface ConfigurableTomcatWebServerFactory
tomcatConnectorCustomizers
- the customizers to addpublic java.util.Collection<TomcatConnectorCustomizer> getTomcatConnectorCustomizers()
TomcatConnectorCustomizer
s that will be
applied to the Tomcat Connector
.public void setTomcatProtocolHandlerCustomizers(java.util.Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers)
TomcatProtocolHandlerCustomizer
s that should be applied to the Tomcat
Connector
. Calling this method will replace any existing customizers.tomcatProtocolHandlerCustomizers
- the customizers to setpublic void addProtocolHandlerCustomizers(TomcatProtocolHandlerCustomizer<?>... tomcatProtocolHandlerCustomizers)
TomcatProtocolHandlerCustomizer
s that should be added to the Tomcat
Connector
.addProtocolHandlerCustomizers
in interface ConfigurableTomcatWebServerFactory
tomcatProtocolHandlerCustomizers
- the customizers to addpublic java.util.Collection<TomcatProtocolHandlerCustomizer<?>> getTomcatProtocolHandlerCustomizers()
TomcatProtocolHandlerCustomizer
s that
will be applied to the Tomcat Connector
.public void addAdditionalTomcatConnectors(org.apache.catalina.connector.Connector... connectors)
Connector
s in addition to the default connector, e.g. for SSL or AJP.
Connector customizers
are not applied to
connectors added this way.
connectors
- the connectors to addpublic java.util.List<org.apache.catalina.connector.Connector> getAdditionalTomcatConnectors()
Connector
s that will be added to the
Tomcat.public void addEngineValves(org.apache.catalina.Valve... engineValves)
ConfigurableTomcatWebServerFactory
Valve
s that should be applied to the Tomcat Engine
.addEngineValves
in interface ConfigurableTomcatWebServerFactory
engineValves
- the valves to addpublic java.util.List<org.apache.catalina.Valve> getEngineValves()
Valve
s that will be applied to the
Tomcat Engine
.public void setUriEncoding(java.nio.charset.Charset uriEncoding)
setUriEncoding
in interface ConfigurableTomcatWebServerFactory
uriEncoding
- the uri encoding to setpublic java.nio.charset.Charset getUriEncoding()
public void setContextLifecycleListeners(java.util.Collection<? extends org.apache.catalina.LifecycleListener> contextLifecycleListeners)
LifecycleListener
s that should be applied to the Tomcat
Context
. Calling this method will replace any existing listeners.contextLifecycleListeners
- the listeners to setpublic java.util.Collection<org.apache.catalina.LifecycleListener> getContextLifecycleListeners()
LifecycleListener
s that will be applied
to the Tomcat Context
.public void addContextLifecycleListeners(org.apache.catalina.LifecycleListener... contextLifecycleListeners)
LifecycleListener
s that should be added to the Tomcat Context
.contextLifecycleListeners
- the listeners to addprotected 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 setProtocol(java.lang.String protocol)
Connector
.protocol
- the protocolConnector(String)
public void setDisableMBeanRegistry(boolean disableMBeanRegistry)
disableMBeanRegistry
- whether to disable the MBean registry