类 TomcatWebServer
java.lang.Object
org.springframework.boot.web.embedded.tomcat.TomcatWebServer
- 所有已实现的接口:
WebServer
WebServer
that can be used to control a Tomcat web server. Usually this class
should be created using the TomcatReactiveWebServerFactory
or
TomcatServletWebServerFactory
, but not directly.- 从以下版本开始:
- 2.0.0
- 作者:
- Brian Clozel, Kristine Jetzke
-
构造器概要
构造器构造器说明TomcatWebServer
(Tomcat tomcat) Create a newTomcatWebServer
instance.TomcatWebServer
(Tomcat tomcat, boolean autoStart) Create a newTomcatWebServer
instance.TomcatWebServer
(Tomcat tomcat, boolean autoStart, Shutdown shutdown) Create a newTomcatWebServer
instance. -
方法概要
修饰符和类型方法说明void
destroy()
Destroys the web server such that it cannot be started again.int
getPort()
Return the port this server is listening on.Returns access to the underlying Tomcat server.void
shutDownGracefully
(GracefulShutdownCallback callback) Initiates a graceful shutdown of the Tomcat web server.void
start()
Starts the web server.void
stop()
Stops the web server.
-
构造器详细资料
-
TomcatWebServer
Create a newTomcatWebServer
instance.- 参数:
tomcat
- the underlying Tomcat server
-
TomcatWebServer
Create a newTomcatWebServer
instance.- 参数:
tomcat
- the underlying Tomcat serverautoStart
- if the server should be started
-
TomcatWebServer
Create a newTomcatWebServer
instance.- 参数:
tomcat
- the underlying Tomcat serverautoStart
- if the server should be startedshutdown
- type of shutdown supported by the server- 从以下版本开始:
- 2.3.0
-
-
方法详细资料
-
start
从接口复制的说明:WebServer
Starts the web server. Calling this method on an already started server has no effect.- 指定者:
start
在接口中WebServer
- 抛出:
WebServerException
- if the server cannot be started
-
stop
从接口复制的说明:WebServer
Stops the web server. Calling this method on an already stopped server has no effect.- 指定者:
stop
在接口中WebServer
- 抛出:
WebServerException
- if the server cannot be stopped
-
destroy
从接口复制的说明:WebServer
Destroys the web server such that it cannot be started again.- 指定者:
destroy
在接口中WebServer
- 抛出:
WebServerException
-
getPort
public int getPort()从接口复制的说明:WebServer
Return the port this server is listening on. -
getTomcat
Returns access to the underlying Tomcat server.- 返回:
- the Tomcat server
-
shutDownGracefully
Initiates a graceful shutdown of the Tomcat web server. Handling of new requests is prevented and the givencallback
is invoked at the end of the attempt. The attempt can be explicitly ended by invokingstop()
.Once shutdown has been initiated Tomcat will reject any new connections. Requests on existing idle connections will also be rejected.
- 指定者:
shutDownGracefully
在接口中WebServer
- 参数:
callback
- the callback to invoke when the graceful shutdown completes
-