public class HelloWorldServer {
public static void main(final String[] args) {
Undertow server = Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(new HttpHandler() {
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
}
}
這是hello世界應用程序使用的下游。 有人可以提供Undertow + CompletableFuture或RxJava的例子嗎?我搜索了但沒有成功。Undertow + CompletableFuture/RxJava
什麼功能是你想實現什麼呢? – yosriz
我想處理請求將查詢數據庫的內容,所以直到數據庫響應我想處理另一個請求 – Romper
請在這裏查看我的答案,您需要了解如何從異步回調創建可觀察數據: http://stackoverflow.com/問題/ 42225722/rxjava-data-from-db-with-on-screen-list/42226534#42226534 – yosriz