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. |
JettyWebServer(org.eclipse.jetty.server.Server server,
boolean autoStart,
Duration shutdownGracePeriod)
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.
|
boolean |
shutDownGracefully()
Gracefully shuts down the web server by preventing the handling of new requests and
waiting for a configurable period for there to be no active requests.
|
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 JettyWebServer(org.eclipse.jetty.server.Server server, boolean autoStart, Duration shutdownGracePeriod)
JettyWebServer
instance.server
- the underlying Jetty serverautoStart
- if auto-starting the servershutdownGracePeriod
- grace period to use when shutting downpublic void start() throws WebServerException
WebServer
start
in interface WebServer
WebServerException
- if the server cannot be startedpublic void stop()
WebServer
public int getPort()
WebServer
public boolean shutDownGracefully()
WebServer
shutDownGracefully
in interface WebServer
true
if graceful shutdown completed within the period, otherwise
false
public org.eclipse.jetty.server.Server getServer()