【发布时间】:2018-11-13 01:44:42
【问题描述】:
如下图所示,我的 HTML 索引页面位于静态文件夹中。如何将 localhost 指向 static/index.html
我自己在基本的 hello world 上尝试过。
static class MyHandler implements HttpHandler {
public void
handle(HttpExchange t) throws IOException {
String response = "Hello world";
t.sendResponseHeaders(200, response.length());
OutputStream os = t.getResponseBody();
os.write(response.getBytes()); os.close();
}
}
我需要知道如何将默认 localhost:8080 指向我预先构建的现有 static/index.html 页面?
【问题讨论】:
标签: java intellij-idea