Javelin WAS is a lightweight, high-performance web application server built on Java Virtual Threads.
It aims to provide a modern alternative to traditional Java-based WAS solutions like Tomcat and Jetty, leveraging Virtual Threads for maximum concurrency and efficiency.
- Virtual Thread-Based Concurrency β Handles thousands of concurrent requests efficiently without blocking OS threads.
- Lightweight & Fast β Designed to be minimal and optimized for high performance.
- Easy Routing β Supports simple and flexible request handling.
- Middleware System β Easily extendable with logging, authentication, and security middleware.
- JSON Support β Built-in JSON serialization and deserialization.
- Static File Serving β Serves static files efficiently without external dependencies.
- Designed for Modern Java Applications β No heavy frameworks required.
- Java 21 or higher (required for Virtual Threads)
- Gradle 7+
git clone https://github.com/your-repo/Javelin.git
cd javelin-was
./gradlew run
Once the server is running, open your browser or use curl
:
curl http://localhost:8080
β Expected Response:
Hello from Javelin Virtual Thread WAS!
public class Main {
public static void main(String[] args) {
VirtualThreadServer server = new VirtualThreadServer(8080);
server.get("/", ctx -> ctx.send("Hello from Javelin Virtual Thread WAS!"));
server.start();
}
}
server.use(ctx -> {
System.out.println("Request Path: " + ctx.path());
ctx.next();
});
server.post("/echo", ctx -> {
Map<String, Object> data = ctx.body(Map.class);
ctx.json(Map.of("you_sent", data));
});
To serve files from a public/
directory under /static
:
server.use(new StaticFileHandler("/static", "public"));
Then access:
http://localhost:8080/static/index.html
Javelin WAS uses Java 21+ Virtual Threads to efficiently handle HTTP requests without the overhead of traditional thread pools.
Each request is processed in a lightweight Virtual Thread, allowing massive concurrency with minimal resource usage.
This project is licensed under the Apache License 2.0.
See the LICENSE
file for more details.
We welcome contributions!
Feel free to submit issues, feature requests, or pull requests.
For inquiries or collaboration:
π© krkarma777@gmail.com