For a minimalistic SimpleFileServer pseudocode below, how to disable directory listing?
var server = HttpsServer.create(new InetSocketAddress(port), 2)
server.createContext("/file", SimpleFileServer.createFileHandler(Path.of("d:\file")));
server.start();
If you put an index file (index.html or index.htm) in the directory, then that will be served, rather than the directory contents.
One more thing: you probably want a / at the end of the context path (so "/file/") as per the note in the API:
Alternatively: