RFR: 8245095: Implementation of JEP 408: Simple Web Server

Jim Laskey jlaskey at openjdk.java.net
Tue Sep 14 16:33:04 UTC 2021

On Tue, 14 Sep 2021 08:52:37 GMT, Julia Boes <jboes at openjdk.org> wrote:

> This change implements a simple web server that can be run on the command-line with `java -m jdk.httpserver`.
> This is facilitated by adding an entry point for the `jdk.httpserver` module, an implementation class whose main method is run when the above command is executed. This is the first such module entry point in the JDK.
> The server is a minimal HTTP server that serves the static files of a given directory, similar to existing alternatives on other platforms and convenient for testing, development, and debugging.
> Additionally, a small API is introduced for programmatic creation and customization.
> Testing: tier1-3.

Very nice. LGTM.

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandlers.java line 128:

> 126:      * <p> {@code headers} are the effective headers of the response. The
> 127:      * response <i>body bytes</i> are a {@code UTF-8} encoded byte sequence of
> 128:      * {@code body}. The response {@linkplain HttpExchange#sendResponseHeaders(int, long) is sent}

Not sure what the javadoc looks like here, but it looks like the link is "is sent". Curious.

src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java line 152:

> 150:         return server;
> 151:     }
> 152: 

Too bad we couldn't simplify the setting up a basic certificate for https.


Marked as reviewed by jlaskey (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5505

More information about the core-libs-dev mailing list