【发布时间】:2014-04-01 06:39:12
【问题描述】:
我正在使用 Undertow 创建一个简单的应用程序。
public class App {
public static void main(String[] args) {
Undertow server = Undertow.builder().addListener(8080, "localhost")
.setHandler(new HttpHandler() {
public void handleRequest(HttpServerExchange exchange) throws Exception {
Thread.sleep(5000);
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
exchange.getResponseSender().send("Hello World");
}
}).build();
server.start();
}
}
我在localhost:8080 上打开一个浏览器选项卡,然后打开第二个
标签也在localhost:8080
这次第一个标签会等待 5 秒,第二个会等待 10 秒
为什么会这样?
【问题讨论】: