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().httpFormDecoder(// <1>
builder -> builder.maxInMemorySize(0)).route(routes -> routes.post("/multipart", (request, response) -> response.sendString(// <2>
request.receiveForm(builder -> builder.maxInMemorySize(256)).flatMap(data -> Mono.just('[' + data.getName() + ']'))))).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("/{param}", (request, response) -> {
if (request.requestHeaders().contains("Some-Header")) {
return response.sendString(Mono.just(request.param("param")));
}
return response.sendNotFound();
})).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) -> response.sendString(Mono.just("hello"))).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) throws Exception {
File defaultCert = new File("default_certificate.crt");
File defaultKey = new File("default_private.key");
File testDomainCert = new File("default_certificate.crt");
File testDomainKey = new File("default_private.key");
SslContext defaultSslContext = SslContextBuilder.forServer(defaultCert, defaultKey).build();
SslContext testDomainSslContext = SslContextBuilder.forServer(testDomainCert, testDomainKey).build();
DisposableServer server = HttpServer.create().secure(spec -> spec.sslContext(defaultSslContext).addSniMapping("*.test.com", testDomainSpec -> testDomainSpec.sslContext(testDomainSslContext))).bindNow();
server.onDispose().block();
}
use of reactor.netty.DisposableServer in project reactor-netty by reactor.
the class CustomLogAccessFormatApplication method main.
public static void main(String[] args) {
DisposableServer server = HttpServer.create().accessLog(true, x -> AccessLog.create("method={}, uri={}", x.method(), x.uri())).bindNow();
server.onDispose().block();
}
Aggregations