Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 22 hours 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 (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T09:16:53.000Z (over 1 year ago)
- Last Synced: 2023-03-05T03:36:28.434Z (over 1 year ago)
- Topics: blocking-queue, http-basic-auth, http-server, java, maven, multithreaded-server, producer-consumer, socket, webserver
- Language: Java
- Homepage:
- Size: 2.19 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- 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
![Index page](screenshots/screenshot01.png)
![Viewing a file](screenshots/screenshot02.jpg)
![BAsic HTTP authorization](screenshots/screenshot03.png)### TODO
- Request for basic authentication if username & password are set
- Allow user to specify web root folder