Skip to content

Embedding

Danny Thomas edited this page Sep 18, 2026 · 1 revision

DocumentationHandler implements the JDK HttpHandler API and can be mounted in any jdk.httpserver server:

try (var docs = DocumentationHandler.create(arguments)) {
    var server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0);
    server.createContext("/", docs);
    server.start();
    try {
        // Run the host application.
    } finally {
        server.stop(0);
    }
}

The host controls the HTTP server lifecycle. Closing the handler removes its temporary documentation output.

DocumentationHandler.optionChecker() exposes the standard documentation and file-manager options accepted by create. Use indexUri() or typeUri(qualifiedName) to obtain a request URI without depending on the handler's route layout, then resolve it against the hosting server's base URI.

Clone this wiki locally