Class UndertowWebServer
java.lang.Object
org.springframework.boot.web.embedded.undertow.UndertowWebServer
- All Implemented Interfaces:
WebServer
- Direct Known Subclasses:
UndertowServletWebServer
WebServer
that can be used to control an Undertow web server. Usually this
class should be created using the UndertowReactiveWebServerFactory
and not
directly.- Since:
- 2.0.0
- Author:
- Ivan Sopov, Andy Wilkinson, EddĂș MelĂ©ndez, Christoph Dreis, Brian Clozel
-
Constructor Summary
ConstructorDescriptionUndertowWebServer
(io.undertow.Undertow.Builder builder, boolean autoStart) Create a newUndertowWebServer
instance.UndertowWebServer
(io.undertow.Undertow.Builder builder, Iterable<HttpHandlerFactory> httpHandlerFactories, boolean autoStart) Create a newUndertowWebServer
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.undertow.server.HttpHandler
int
getPort()
Return the port this server is listening on.protected String
void
shutDownGracefully
(GracefulShutdownCallback callback) Initiates a graceful shutdown of the web server.void
start()
Starts the web server.void
stop()
Stops the web server.
-
Constructor Details
-
UndertowWebServer
public UndertowWebServer(io.undertow.Undertow.Builder builder, boolean autoStart) Create a newUndertowWebServer
instance.- Parameters:
builder
- the builderautoStart
- if the server should be started
-
UndertowWebServer
public UndertowWebServer(io.undertow.Undertow.Builder builder, Iterable<HttpHandlerFactory> httpHandlerFactories, boolean autoStart) Create a newUndertowWebServer
instance.- Parameters:
builder
- the builderhttpHandlerFactories
- the handler factoriesautoStart
- if the server should be started- Since:
- 2.3.0
-
-
Method Details
-
start
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
-
createHttpHandler
protected io.undertow.server.HttpHandler createHttpHandler() -
stop
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. -
shutDownGracefully
Description copied from interface:WebServer
Initiates a graceful shutdown of the web server. Handling of new requests is prevented and the givencallback
is invoked at the end of the attempt. The attempt can be explicitly ended by invokingWebServer.stop()
. The default implementation invokes the callback immediately withGracefulShutdownResult.IMMEDIATE
, i.e. no attempt is made at a graceful shutdown.- Specified by:
shutDownGracefully
in interfaceWebServer
- Parameters:
callback
- the callback to invoke when the graceful shutdown completes
-
getStartLogMessage
-