List of usage examples for org.springframework.http.server.reactive ServletHttpHandlerAdapter ServletHttpHandlerAdapter
public ServletHttpHandlerAdapter(HttpHandler httpHandler)
From source file:top.zhacker.ms.reactor.spring.function.Server.java
public void startTomcatServer() throws LifecycleException { RouterFunction<?> route = routingFunction(); HttpHandler httpHandler = toHttpHandler(route); Tomcat tomcatServer = new Tomcat(); tomcatServer.setHostname(HOST);/*ww w .j a va 2 s . c o m*/ tomcatServer.setPort(PORT); Context rootContext = tomcatServer.addContext("", System.getProperty("java.io.tmpdir")); ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); rootContext.addServletMapping("/", "httpHandlerServlet"); tomcatServer.start(); }