Java Code Examples for org.springframework.boot.web.reactive.server.ReactiveWebServerFactory

The following examples show how to use org.springframework.boot.web.reactive.server.ReactiveWebServerFactory. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: pitchfork   Source File: RoutingConfig.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Since we're impersonating a {@code Zipkin} server we need to support the same set of features.
 * One of the features is request compression, which we handle here by adding a {@link HttpContentDecompressor} to the {@code Netty} pipeline.
 */
@Bean
public ReactiveWebServerFactory reactiveWebServerFactory() {
    NettyReactiveWebServerFactory factory = new NettyReactiveWebServerFactory();

    factory.addServerCustomizers(builder -> builder
            .tcpConfiguration(tcpServer -> {
                return tcpServer.doOnConnection(connection -> connection.addHandler("decompressor", new HttpContentDecompressor()));
            }));

    return factory;
}
 
Example 2
private static void runServer(ReactiveWebServerFactory factory,
                              HttpHandler httpHandler,
                              Consumer<WebServer> validator) {
    final WebServer server = factory.getWebServer(httpHandler);
    server.start();
    try {
        validator.accept(server);
    } finally {
        server.stop();
    }
}
 
Example 3
Source Project: feign-reactive   Source File: AllFeaturesTest.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public ReactiveWebServerFactory reactiveWebServerFactory(){
	return new NettyReactiveWebServerFactory();
}
 
Example 4
private static void runEchoServer(ReactiveWebServerFactory factory,
                                  Consumer<WebServer> validator) {
    runServer(factory, EchoHandler.INSTANCE, validator);
}