Return to site

☕1️⃣8️⃣ JDK18 NEWS: Java's new simple web server

· java

Java 18 will provide a minimally functional web server in the jdk.httpserver module.

It has an API for access, as well as a binary in the bin directory in case you want to run the server from the command line.

The command to run the web server can be as simple as:

If you are wondering whether you can implement a full-blown production web server using the simple web server APIs, the answer is no.

The web server is definitely not intended for that use.

For one thing, it communicates over HTTP/1.1 and doesn't support PUT requests, so it doesn't support dynamic content.

The web server is recommended for prototyping, testing, and debugging. An example code snippet with comments follows:



All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!