public final class HttpServer extends Object implements NettyConnector<HttpServerRequest,HttpServerResponse>
| Modifier and Type | Method and Description |
|---|---|
static HttpServer |
create()
Build a simple Netty HTTP server listening on localhost (127.0.0.1) and
port 80.
|
static HttpServer |
create(java.util.function.Consumer<? super HttpServerOptions> options)
Build a simple Netty HTTP server listening over bind address and port passed
through the
HttpServerOptions. |
static HttpServer |
create(int port)
Build a simple Netty HTTP server listening on localhost (127.0.0.1) and the provided
port
Use 0 to let the system assign a random port.
|
static HttpServer |
create(String bindAddress)
Build a simple Netty HTTP server listening on the provided bind address and
port 80.
|
static HttpServer |
create(String bindAddress,
int port)
Build a simple Netty HTTP server listening on the provided bind address and port.
|
Mono<? extends NettyContext> |
newHandler(java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler) |
Mono<? extends NettyContext> |
newRouter(java.util.function.Consumer<? super HttpServerRoutes> routesBuilder)
Define routes for the server through the provided
HttpServerRoutes builder. |
public static HttpServer create()
public static HttpServer create(java.util.function.Consumer<? super HttpServerOptions> options)
HttpServerOptions.
Use 0 to let the system assign a random port.options - the options for the server, including bind address and port.public static HttpServer create(int port)
port - the port to listen to, or 0 to dynamically attribute one.public static HttpServer create(String bindAddress)
bindAddress - address to listen for (e.g. 0.0.0.0 or 127.0.0.1)public static HttpServer create(String bindAddress, int port)
bindAddress - address to listen for (e.g. 0.0.0.0 or 127.0.0.1)port - the port to listen to, or 0 to dynamically attribute one.public Mono<? extends NettyContext> newHandler(java.util.function.BiFunction<? super HttpServerRequest,? super HttpServerResponse,? extends Publisher<Void>> handler)
newHandler in interface Connector<ByteBuf,ByteBuf,HttpServerRequest,HttpServerResponse>public Mono<? extends NettyContext> newRouter(java.util.function.Consumer<? super HttpServerRoutes> routesBuilder)
HttpServerRoutes builder.routesBuilder - provides a route builder to be mutated in order to define routes.Mono starting the router on subscribe