RFR: 8245095: Implementation of JEP 408: Simple Web Server
Jaikiran Pai
jpai at openjdk.java.net
Tue Sep 14 15:34:03 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.
src/java.base/windows/classes/sun/net/www/content-types.properties line 30:
> 28: application/octet-stream: \
> 29: description=Generic Binary Stream;\
> 30: file_extensions=.saveme,.dump,.hqx,.arc,.obj,.lib,.bin,.exe,.gz
Hello Julia,
Is this an intentional change, to remove the mapping of `.zip` to `application/octet-stream`? In a later part of this patch there's a commented out test `testCommonExtensions` which deals with these extension types and that has a link to https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types which states that `.zip` should be mapped to `application/zip` instead of the current `application/octet-stream`, so I'm guessing this changed line is intentional.
On an unrelated note, the unix variant of this file `src/java.base/unix/classes/sun/net/www/content-types.properties` interestingly uses `.z` for `.zip`? Commit history on that file doesn't provide any hint on whether that is intentional either.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5505
More information about the core-libs-dev
mailing list