public class UndertowWebServer extends Object implements WebServer
WebServer
that can be used to control an Undertow web server. Usually this
class should be created using the UndertowReactiveWebServerFactory
and not
directly.Constructor and Description |
---|
UndertowWebServer(io.undertow.Undertow.Builder builder,
boolean autoStart)
Create a new
UndertowWebServer instance. |
UndertowWebServer(io.undertow.Undertow.Builder builder,
boolean autoStart,
Closeable closeable)
Deprecated.
since 2.3.0 for removal in 2.5.0 in favor of
UndertowWebServer(io.undertow.Undertow.Builder, Iterable, boolean) |
UndertowWebServer(io.undertow.Undertow.Builder builder,
Iterable<HttpHandlerFactory> httpHandlerFactories,
boolean autoStart)
Create a new
UndertowWebServer instance. |
Modifier and Type | Method and Description |
---|---|
protected io.undertow.server.HttpHandler |
createHttpHandler() |
int |
getPort()
Return the port this server is listening on.
|
protected String |
getStartLogMessage() |
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 UndertowWebServer(io.undertow.Undertow.Builder builder, boolean autoStart)
UndertowWebServer
instance.builder
- the builderautoStart
- if the server should be started@Deprecated public UndertowWebServer(io.undertow.Undertow.Builder builder, boolean autoStart, Closeable closeable)
UndertowWebServer(io.undertow.Undertow.Builder, Iterable, boolean)
UndertowWebServer
instance.builder
- the builderautoStart
- if the server should be startedcloseable
- called when the server is stoppedpublic UndertowWebServer(io.undertow.Undertow.Builder builder, Iterable<HttpHandlerFactory> httpHandlerFactories, boolean autoStart)
UndertowWebServer
instance.builder
- the builderhttpHandlerFactories
- the handler factoriesautoStart
- if the server should be startedpublic void start() throws WebServerException
WebServer
start
in interface WebServer
WebServerException
- if the server cannot be startedprotected io.undertow.server.HttpHandler createHttpHandler()
public void stop() throws WebServerException
WebServer
stop
in interface WebServer
WebServerException
- if the server cannot be stoppedpublic 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 completesprotected String getStartLogMessage()