https://github.com/tomiwa-ot/java-web-server
Simple HTTP server written in Java
https://github.com/tomiwa-ot/java-web-server
blocking-queue http-basic-auth http-server java maven multithreaded-server producer-consumer socket webserver
Last synced: about 1 month ago
JSON representation
Simple HTTP server written in Java
- Host: GitHub
- URL: https://github.com/tomiwa-ot/java-web-server
- Owner: Tomiwa-Ot
- License: apache-2.0
- Created: 2022-01-23T08:20:04.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-26T14:03:45.000Z (about 2 years ago)
- Last Synced: 2025-04-03T11:55:23.451Z (about 2 months ago)
- Topics: blocking-queue, http-basic-auth, http-server, java, maven, multithreaded-server, producer-consumer, socket, webserver
- Language: Java
- Homepage:
- Size: 2.2 MB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Java Web Server
A simple multithreaded HTTP server built with the Producer-Consumer design pattern and synchronised with blocking queues.
### Features
- Directory Listing
- Basic HTTP Authentication
- Logs all requests ```webserver.log```### Configuration
#### Port
The default port used is 8080. It can be modified either by changing the port value in [properties.json](src/main/resources/properties.json) or supply it as an argument in the console.
```console
javac App.java
java App
```
#### Basic HTTP Authentication
To enable, change the username value from ```null``` to `````` and password value from ```null``` to a Bcrypt hash of the password in [properties.json](src/main/resources/properties.json)
```json
{
"username" : "your_username",
"password" : "Bcrypt hash",
}
```
To disable, set the username and password values as ```null```.#### Worker Threads and Connection Queue
The number of consumer threads and blocking queue size can be modified in [properties.json](src/main/resources/properties.json)
```json
{
"worker_threads" : 20,
"connection_queue" : 30
}
```#### Screenshots


### TODO
- Request for basic authentication if username & password are set
- Allow user to specify web root folder