https://github.com/krkarma777/javelin
A high-performance, lightweight Java Web Application Server powered by Virtual Threads. ๐
https://github.com/krkarma777/javelin
concurrency high-performance http-server java java21 javelin lightweight modern-java virtual-threads was web-server
Last synced: about 1 month ago
JSON representation
A high-performance, lightweight Java Web Application Server powered by Virtual Threads. ๐
- Host: GitHub
- URL: https://github.com/krkarma777/javelin
- Owner: krkarma777
- License: apache-2.0
- Created: 2025-02-24T07:01:40.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-03T08:26:27.000Z (about 1 year ago)
- Last Synced: 2025-04-03T09:30:50.545Z (about 1 year ago)
- Topics: concurrency, high-performance, http-server, java, java21, javelin, lightweight, modern-java, virtual-threads, was, web-server
- Language: Java
- Homepage:
- Size: 1.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Javelin WAS - A High-Performance Virtual Thread-Based Web Application Server ๐
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.
---
## ๐ฅ Features
- **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.
---
## โ Requirements
- Java **21** or higher (required for Virtual Threads)
- Gradle **7+**
---
## ๐ ๏ธ Installation & Running
### 1. Clone the repository
```sh
git clone https://github.com/your-repo/Javelin.git
cd javelin-was
```
### 2. Build & Run (Using Gradle)
```sh
./gradlew run
```
---
## ๐ Test the Server
Once the server is running, open your browser or use `curl`:
```sh
curl http://localhost:8080
```
โ
**Expected Response:**
```
Hello from Javelin Virtual Thread WAS!
```
#### โ
Example Code (Minimal)
```java
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();
}
}
```
---
## ๐งช Example Usage
### ๐งฉ Middleware
```java
server.use(ctx -> {
System.out.println("Request Path: " + ctx.path());
ctx.next();
});
```
### ๐ฆ JSON Handling
```java
server.post("/echo", ctx -> {
Map data = ctx.body(Map.class);
ctx.json(Map.of("you_sent", data));
});
```
---
## ๐ Serving Static Files
To serve files from a `public/` directory under `/static`:
```java
server.use(new StaticFileHandler("/static", "public"));
```
Then access:
```
http://localhost:8080/static/index.html
```
---
## ๐ง How It Works
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**.
---
## ๐ License
This project is licensed under the **Apache License 2.0**.
See the [`LICENSE`](LICENSE) file for more details.
---
## ๐ฅ Contributing
We welcome contributions!
Feel free to submit issues, feature requests, or pull requests.
---
## ๐ง Contact
For inquiries or collaboration:
**๐ฉ krkarma777@gmail.com**
---