What is Java’s simple http server?
Simple http server released in java 18. Is a command line tool which offers a minimal HTTP server, which serves a single file hierarchy. It based on the web server implementation in the com.sun.net.httpserver package.
General Q & A
What are the limitations?
Supports only GET and HEAD methods.
Supports HTTP 1.1. No HTTP 2.
Supports only HTTP. No HTTPS.
What can this http server be used for?
The example starts a simple http web server, which randomly displays a famous quote.
Initialize with parameters.
Set the Port number
Set the file path to where your html directory is located.
(Optional) set the log level
Start the server.
Example can be found here.
This again is following a trend by other languages such as Ruby, Erlang, Python etc, with an out-of-the-box servers from a command line, but I have yet to find a use for it, such as Jshell.