MCPcopy Index your code
hub / github.com/ebarlas/java-httpserver-vthreads / main

Method main

src/httpsrv/Hello.java:11–23  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

9public class Hello {
10
11 public static void main(String[] args) throws IOException {
12 var body = "hello world".getBytes();
13 var server = HttpServer.create(new InetSocketAddress(8080), 0);
14 server.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
15 server.createContext("/").setHandler(exchange -> {
16 exchange.sendResponseHeaders(200, body.length);
17 try (var os = exchange.getResponseBody()) {
18 os.write(body);
19 }
20 });
21 server.start();
22 System.out.println("ready");
23 }
24
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected