public class UndertowServletWebServer extends Object implements WebServer
WebServer
that can be used to control an embedded Undertow server. Typically
this class should be created using UndertowServletWebServerFactory
and not
directly.UndertowServletWebServerFactory
Constructor and Description |
---|
UndertowServletWebServer(io.undertow.Undertow.Builder builder,
io.undertow.servlet.api.DeploymentManager manager,
String contextPath,
boolean useForwardHeaders,
boolean autoStart,
Compression compression)
Create a new
UndertowServletWebServer instance. |
UndertowServletWebServer(io.undertow.Undertow.Builder builder,
io.undertow.servlet.api.DeploymentManager manager,
String contextPath,
boolean useForwardHeaders,
boolean autoStart,
Compression compression,
String serverHeader)
Create a new
UndertowServletWebServer instance. |
UndertowServletWebServer(io.undertow.Undertow.Builder builder,
io.undertow.servlet.api.DeploymentManager manager,
String contextPath,
boolean useForwardHeaders,
boolean autoStart,
Compression compression,
String serverHeader,
Duration shutdownGracePeriod)
Create a new
UndertowServletWebServer instance. |
UndertowServletWebServer(io.undertow.Undertow.Builder builder,
io.undertow.servlet.api.DeploymentManager manager,
String contextPath,
boolean autoStart,
Compression compression)
Create a new
UndertowServletWebServer instance. |
Modifier and Type | Method and Description |
---|---|
io.undertow.servlet.api.DeploymentManager |
getDeploymentManager() |
int |
getPort()
Return the port this server is listening on.
|
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 UndertowServletWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, String contextPath, boolean autoStart, Compression compression)
UndertowServletWebServer
instance.builder
- the buildermanager
- the deployment managercontextPath
- the root context pathautoStart
- if the server should be startedcompression
- compression configurationpublic UndertowServletWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, String contextPath, boolean useForwardHeaders, boolean autoStart, Compression compression)
UndertowServletWebServer
instance.builder
- the buildermanager
- the deployment managercontextPath
- the root context pathuseForwardHeaders
- if x-forward headers should be usedautoStart
- if the server should be startedcompression
- compression configurationpublic UndertowServletWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, String contextPath, boolean useForwardHeaders, boolean autoStart, Compression compression, String serverHeader)
UndertowServletWebServer
instance.builder
- the buildermanager
- the deployment managercontextPath
- the root context pathuseForwardHeaders
- if x-forward headers should be usedautoStart
- if the server should be startedcompression
- compression configurationserverHeader
- string to be used in HTTP headerpublic UndertowServletWebServer(io.undertow.Undertow.Builder builder, io.undertow.servlet.api.DeploymentManager manager, String contextPath, boolean useForwardHeaders, boolean autoStart, Compression compression, String serverHeader, Duration shutdownGracePeriod)
UndertowServletWebServer
instance.builder
- the buildermanager
- the deployment managercontextPath
- the root context pathuseForwardHeaders
- if x-forward headers should be usedautoStart
- if the server should be startedcompression
- compression configurationserverHeader
- string to be used in HTTP headershutdownGracePeriod
- the period to wait for activity to cease when shutting
down the server gracefullypublic void start() throws WebServerException
WebServer
start
in interface WebServer
WebServerException
- if the server cannot be startedpublic io.undertow.servlet.api.DeploymentManager getDeploymentManager()
public void stop() throws WebServerException
WebServer
stop
in interface WebServer
WebServerException
- if the server cannot be stoppedpublic int getPort()
WebServer
public boolean shutDownGracefully()
WebServer
shutDownGracefully
in interface WebServer
true
if graceful shutdown completed within the period, otherwise
false