public class JettyWebServer extends Object implements WebServer
WebServer
that can be used to control a Jetty web server.JettyReactiveWebServerFactory
Constructor and Description |
---|
JettyWebServer(org.eclipse.jetty.server.Server server)
Create a new
JettyWebServer instance. |
JettyWebServer(org.eclipse.jetty.server.Server server,
boolean autoStart)
Create a new
JettyWebServer instance. |
Modifier and Type | Method and Description |
---|---|
int |
getPort()
Return the port this server is listening on.
|
org.eclipse.jetty.server.Server |
getServer()
Returns access to the underlying Jetty Server.
|
void |
shutDownGracefully(GracefulShutdownCallback callback)
Initiates a graceful shutdown of the web server.
|
void |
start()
Starts the web server.
|
void |
stop()
Stops the web server.
|
public JettyWebServer(org.eclipse.jetty.server.Server server)
JettyWebServer
instance.server
- the underlying Jetty serverpublic JettyWebServer(org.eclipse.jetty.server.Server server, boolean autoStart)
JettyWebServer
instance.server
- the underlying Jetty serverautoStart
- if auto-starting the serverpublic void start() throws WebServerException
WebServer
start
in interface WebServer
WebServerException
- if the server cannot be startedpublic void stop()
WebServer
public int getPort()
WebServer
public void shutDownGracefully(GracefulShutdownCallback callback)
WebServer
callback
is invoked at the end of the attempt. The
attempt can be explicitly ended by invoking WebServer.stop()
. The default
implementation invokes the callback immediately with
GracefulShutdownResult.IMMEDIATE
, i.e. no attempt is made at a graceful
shutdown.shutDownGracefully
in interface WebServer
callback
- the callback to invoke when the graceful shutdown completespublic org.eclipse.jetty.server.Server getServer()