Java lightweight web serverside framework
- HTTP Request handling
- HTTP Response
- Files type
- Text files
- Binary files
- JSON from Object
- Method
- GET
- POST
- PUT
- DELETE
- File routing
- Static files routing
- Default file routing (from a Router class)
- Param file routing
- Encoding
- GZIP
- Deflate
- Optimizing
- Cache request
- Fast cache lookup
- More ??..
- Features from the framework
- Namespaces
- More ...
- Support HTTP version
- HTTP/1.1
- HTTP/2
- HTTP/3
class HTTPServer{
public static void main(String[] args) {
launch(new HTTPServer());
}
public HTTPServer() {
super("./conf.toml");
}
@HTTP(url = "/")
public Route indexRoute = new FileRoute("index.html");
@HTTP(url = "/test")
public View index(Request req, Response res) {
res.setHeader("Content-Type", "text/plain");
return new TextView("This is a test!");
}
@Override
public void route(Router router) {
router.route(this);
router.staticRoute("./static"); // Static file routing (eg: png, jpg, xml files)
}
}