A fast, highly expressive modern Java web framework.
Focus on your features, not boilerplate, with built-in request validation and fallback handlers that ensure robustness out of the box.
//Main.java
public class MyProject {
public static void main(String[] args) {
port(8080);
route("/myendpoint")
.register(MyHandler.class);
start();
}
}
//MyHandler.java
@RouteInfo(endpoint = "/hello", method = HttpMethod.GET)
public class MyHandler extends RequestHandler {
private final ExpectedRequestParameter p1;
public TestHandler(Request req, Response res) {
super(req, res);
p1 = expectedRequestParameter("p1", "My first parameter");
}
@Override
public Object handle() {
res.status(200);
return "Hello World! p1 is: " + p1.getString();
}
}
$ curl "http://localhost:8080/myendpoint/hello?p1=Flash"
➡️ "Hello World! p1 is: Flash"