Interface WebServer
- All Known Implementing Classes:
- JettyWebServer,- NettyWebServer,- TomcatWebServer,- UndertowServletWebServer,- UndertowWebServer
public interface WebServer
Simple interface that represents a fully configured web server (for example Tomcat,
 Jetty, Netty). Allows the server to be 
started and stopped.- Since:
- 2.0.0
- 
Method SummaryModifier and TypeMethodDescriptiondefault voiddestroy()Destroys the web server such that it cannot be started again.intgetPort()Return the port this server is listening on.default voidshutDownGracefully(GracefulShutdownCallback callback) Initiates a graceful shutdown of the web server.voidstart()Starts the web server.voidstop()Stops the web server.
- 
Method Details- 
startStarts the web server. Calling this method on an already started server has no effect.- Throws:
- WebServerException- if the server cannot be started
 
- 
stopStops the web server. Calling this method on an already stopped server has no effect.- Throws:
- WebServerException- if the server cannot be stopped
 
- 
getPortint getPort()Return the port this server is listening on.- Returns:
- the port (or -1 if none)
 
- 
shutDownGracefullyInitiates a graceful shutdown of the web server. Handling of new requests is prevented and the givencallbackis invoked at the end of the attempt. The attempt can be explicitly ended by invokingstop(). The default implementation invokes the callback immediately withGracefulShutdownResult.IMMEDIATE, i.e. no attempt is made at a graceful shutdown.- Parameters:
- callback- the callback to invoke when the graceful shutdown completes
- Since:
- 2.3.0
 
- 
destroydefault void destroy()Destroys the web server such that it cannot be started again.- Since:
- 3.2.0
 
 
-