Key Features • How To Use • License • Credits
@GET(url = "/hello/{userId}")
@View(template = "hello_user.ftl")
public Map<String, Object> hello(int userId) {
return Map.of(
"user", userManager.getUserById(userId)
);
}
We believe the web-developers should focus on the application and not web/HTTP routine as much as possible. The snippet above is a working example of a web handler that will accept the incoming HTTP request with already extracted URL variables, inject dependencies if necessary, render the template and send the HTTP response.
Webby applies a large variety of optimizations to provide the best latency and GC-friendliness: pre-compute, caching, byte buffer pooling, char buffer reuse and many more.
public class Pojo {
@GET(url="/blog_post/{id}/{slug}")
public @Json List getBlogPost(int postId, String slug) {
return List.of(...);
}
}
Webby does not require any code structure, base class inheritance, database, ORM and templating system. A developer has the freedom to apply the library in any way they want.
Since Webby is in active development, the best way to add a Gradle dependency is via gitRepository
directive.
settings.gradle
sourceControl {
gitRepository('https://github.com/maxim5/webby.git') {
producesModule("io.webby:webby")
}
}
build.gradle
implementation ('io.webby:webby:0.8.0')
To start the web server locally:
public class Main {
public static void main(String[] args) throws Exception {
AppSettings settings = new AppSettings();
settings.setWebPath("src/main/resources/web/");
Webby.nettyBootstrap(settings).runLocally(8080);
}
}
... and Webby will do the rest.
Many thanks to Lucas the Spider for the amazing character which inspired our logo.