use of org.springframework.http.server.reactive.ReactorHttpHandlerAdapter in project tutorials by eugenp.
the class SpringSecurity5Application method nettyContext.
@Bean
public NettyContext nettyContext(ApplicationContext context) {
HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
HttpServer httpServer = HttpServer.create("localhost", 8080);
return httpServer.newHandler(adapter).block();
}
use of org.springframework.http.server.reactive.ReactorHttpHandlerAdapter in project tutorials by eugenp.
the class Spring5ReactiveServerClientIntegrationTest method setUp.
@BeforeAll
public static void setUp() throws Exception {
HttpServer server = HttpServer.create("localhost", 8080);
RouterFunction<?> route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok().body(request.bodyToFlux(Task.class).map(ll -> new Task("TaskName", 1)), Task.class)).and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok().body(Mono.just("server is alive"), String.class)));
HttpHandler httpHandler = RouterFunctions.toHttpHandler(route);
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
nettyContext = server.newHandler(adapter).block();
}
use of org.springframework.http.server.reactive.ReactorHttpHandlerAdapter in project spring-boot by spring-projects.
the class NettyReactiveWebServerFactory method getWebServer.
@Override
public WebServer getWebServer(HttpHandler httpHandler) {
HttpServer server = createHttpServer();
ReactorHttpHandlerAdapter handlerAdapter = new ReactorHttpHandlerAdapter(httpHandler);
return new NettyWebServer(server, handlerAdapter);
}
Aggregations