public class WebServer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected io.netty.channel.EventLoopGroup |
acceptorGroup
The connection acceptor event loop group, handling server channels.
|
protected String |
address
The address this web server is bound to.
|
protected int |
port
The port this web server is bound to.
|
protected io.netty.bootstrap.ServerBootstrap |
serverBootstrap
The bootstrap of this server using Netty.
|
protected boolean |
ssl
Whether SSL should be enabled.
|
protected io.netty.handler.ssl.SslContext |
sslContext
The SSL context with certificate and private key, when SSL is enabled.
|
protected WebServerProvider |
webServerProvider
The web handler provider of this web server.
|
protected io.netty.channel.EventLoopGroup |
workerGroup
The child event loop group to the acceptor group, handling channels.
|
| Constructor and Description |
|---|
WebServer(boolean ssl,
String host,
int port)
Constructs a new web server with the given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bind()
Actually binds the web server to the configured port.
|
io.netty.channel.EventLoopGroup |
getAcceptorGroup() |
String |
getAddress() |
int |
getPort() |
io.netty.bootstrap.ServerBootstrap |
getServerBootstrap() |
io.netty.handler.ssl.SslContext |
getSslContext() |
WebServerProvider |
getWebServerProvider() |
io.netty.channel.EventLoopGroup |
getWorkerGroup() |
void |
shutdown()
Shuts the event loop groups down and awaits their termination.
|
protected String address
protected int port
protected boolean ssl
protected io.netty.channel.EventLoopGroup acceptorGroup
protected io.netty.channel.EventLoopGroup workerGroup
protected io.netty.handler.ssl.SslContext sslContext
sslprotected WebServerProvider webServerProvider
protected io.netty.bootstrap.ServerBootstrap serverBootstrap
public WebServer(boolean ssl,
String host,
int port)
throws CertificateException,
SSLException
ssl - whether to use SSL with a self-signed certificatehost - the host this web server is bound to.port - the port this web server is bound to.CertificateException - thrown when the certificate could not
be generated.SSLException - thrown when an error during the creation of the
ssl context occurred.public io.netty.channel.EventLoopGroup getAcceptorGroup()
public io.netty.channel.EventLoopGroup getWorkerGroup()
public int getPort()
public io.netty.bootstrap.ServerBootstrap getServerBootstrap()
public io.netty.handler.ssl.SslContext getSslContext()
public String getAddress()
public WebServerProvider getWebServerProvider()
public void shutdown()
public void bind()
throws InterruptedException
InterruptedException - thrown when the synchronous call is interrupted.Copyright © 2020. All rights reserved.