I need to build a simple HTTP server in Java using only the standard Java API. I found this question: simple HTTP server in Java using only Java SE API which has two answers that use only the standard Java API:
So, what is the current official way to create a web-server?
The simple server, found in com.sun.net.httpserver
is an official, but optional API in Java 9, located in the module jdk.httpserver
. This implies that you can expect it to be maintained in OpenJDK, but not to be available in every JRE.
If you can live with these conditions, you can use it.