A super simple and lightweight HTTP server written in Java.
- HTTP/1.1
- Supports cookies
- File serving/streaming
- Supports partial content responses (
Range
header) - Supports ETags
- Sends large files without memory overhead (e.g.
mp4
)
- Supports partial content responses (
This starts a server on port 8080, with a single route returning plain text.
HttpServer server = new HttpServer(8080)
.use(new Router()
.get("/hello", req -> new Response(Status.OK).body("Hello, world!"))
)
.start();
System.out.println("Web server listening on port " + server.getPort());