An experimental http server for utilising virtual thread features.
Not for production uses!
class Main {
public static void main(String[] args) throws IOException {
try (var server = new HttpRequestHandler(20000)) {
server.setHttpRequestListener((request) -> switch (request.path()) {
case "/hello" -> new HttpResponses.Status200("text/plain-text", "hello");
case "/bye" -> new HttpResponses.Status204();
default -> new HttpResponses.Status404("text/plain-text", "404 error");
});
server.run();
}
}
}
- Uses Virtual Threads
- JDK version 20+
- org.slf4j library
- Testing and Running requirements
./gradlew test
./gradlew build
Licensed under MIT License