【发布时间】:2018-05-21 16:18:56
【问题描述】:
我是 Java 新手。我在Golang 中使用了写服务器。我需要回复HttpExchange。这是我的代码:
public static void main(String[] args) throws IOException
{
Server = HttpServer.create(new InetSocketAddress(8000),0);
Server.createContext("/login", new SimpleHandler());
Server.setExecutor(null);
Server.start();
}
class SimpleHandler implements HttpHandler
{
@Override
public void handle(HttpExchange request) throws IOException
{
//Here I need to do like request.Response.Write(200,"DONE");
}
}
【问题讨论】:
-
这就是我要找的那个。谢谢!!!
标签: java sockets jakarta-ee httpserver