Mu Server quick start
Mu Server: Java's modern web server
Quick Start
Add one dependency...
<dependency>
<groupId>io.muserver</groupId>
<artifactId>mu-server</artifactId>
<version>2.1.2</version>
</dependency>
...and say hello:
import io.muserver.*;
public class Hello {
public static void main(String[] args) {
MuServer server = MuServerBuilder.httpServer()
.addHandler(Method.GET, "/", (request, response, pathParams) -> {
response.write("Hello, world");
})
.start();
System.out.println("Started server at " + server.uri());
}
}
Upgrading to 2.x? See the upgrade notes.
Features
- Flexible routing and filtering with request handlers
- A clean model giving simple access to request and response objects
- HTTP/2 Support
- Convenient static resource handling, with GZIP, range requests, and custom response headers based on file type.
- Extremely simple HTTPS configuration including Let's Encrypt integration and optional Mutual TLS
- Server Sent Events
- Web Sockets
- JAX-RS Rest support with no extra dependencies, including:
- Automatic documentation for rest services
- Simple CORS support for JAX-RS
- File Upload support
- Optional async handling
- Path contexts
- A Reverse Proxy handler
- Statistics
- Various useful utilities
Each release is tested with Java 8, 11, 17 and 21.