Class TomcatWebServer
- java.lang.Object
- org.springframework.boot.web.embedded.tomcat.TomcatWebServer
- All Implemented Interfaces:
WebServer
public class TomcatWebServer extends Object implements WebServer
WebServer
that can be used to control a Tomcat web server. Usually this class should be created using theTomcatReactiveWebServerFactory
ofTomcatServletWebServerFactory
, but not directly.- Since:
- 2.0.0
Constructor Summary
Constructors Constructor Description TomcatWebServer(org.apache.catalina.startup.Tomcat tomcat)
Create a newTomcatWebServer
instance.TomcatWebServer(org.apache.catalina.startup.Tomcat tomcat, boolean autoStart)
Create a newTomcatWebServer
instance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPort()
Return the port this server is listening on.org.apache.catalina.startup.Tomcat
getTomcat()
Returns access to the underlying Tomcat server.void
start()
Starts the web server.void
stop()
Stops the web server.
Constructor Detail
TomcatWebServer
public TomcatWebServer(org.apache.catalina.startup.Tomcat tomcat)
Create a newTomcatWebServer
instance.- Parameters:
tomcat
- the underlying Tomcat server
TomcatWebServer
public TomcatWebServer(org.apache.catalina.startup.Tomcat tomcat, boolean autoStart)
Create a newTomcatWebServer
instance.- Parameters:
tomcat
- the underlying Tomcat serverautoStart
- if the server should be started
Method Detail
start
public void start() throws WebServerException
Description copied from interface:WebServer
Starts the web server. Calling this method on an already started server has no effect.- Specified by:
start
in interfaceWebServer
- Throws:
WebServerException
- if the server cannot be started
stop
public void stop() throws WebServerException
Description copied from interface:WebServer
Stops the web server. Calling this method on an already stopped server has no effect.- Specified by:
stop
in interfaceWebServer
- Throws:
WebServerException
- if the server cannot be stopped
getPort
public int getPort()
Description copied from interface:WebServer
Return the port this server is listening on.
getTomcat
public org.apache.catalina.startup.Tomcat getTomcat()
Returns access to the underlying Tomcat server.- Returns:
- the Tomcat server