use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
// <1>
Metrics.globalRegistry.config().meterFilter(MeterFilter.maximumAllowableTags("reactor.netty.http.server", "URI", 100, MeterFilter.deny()));
DisposableServer server = HttpServer.create().metrics(true, s -> {
if (s.startsWith("/stream/")) {
// <2>
return "/stream/{n}";
} else if (s.startsWith("/bytes/")) {
return "/bytes/{n}";
}
return s;
}).route(r -> r.get("/stream/{n}", (req, res) -> res.sendString(Mono.just(req.param("n")))).get("/bytes/{n}", (req, res) -> res.sendString(Mono.just(req.param("n"))))).bindNow();
server.onDispose().block();
}
use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
DisposableServer server = HttpServer.create().handle(// <1>
(request, response) -> request.receive().then()).bindNow();
server.onDispose().block();
}
use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
DisposableServer server = HttpServer.create().route(routes -> routes.get("/hello", (request, response) -> response.status(HttpResponseStatus.OK).header(HttpHeaderNames.CONTENT_LENGTH, "12").sendString(Mono.just("Hello World!")))).bindNow();
server.onDispose().block();
}
use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class Application method main.
public static void main(String[] args) {
DisposableServer server = TcpServer.create().host(// <1>
"localhost").port(// <2>
8080).bindNow();
server.onDispose().block();
}
use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class MultiAddressApplication method main.
public static void main(String[] args) {
TcpServer tcpServer = TcpServer.create();
DisposableServer server1 = tcpServer.host(// <1>
"localhost").port(// <2>
8080).bindNow();
DisposableServer server2 = tcpServer.host(// <3>
"0.0.0.0").port(// <4>
8081).bindNow();
Mono.when(server1.onDispose(), server2.onDispose()).block();
}
Aggregations