https://github.com/adamouization/http-web-server
:globe_with_meridians: Implementation of a simple HTTP server in Java, supporting basic requests and binary images.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Keywords
Repository
:globe_with_meridians: Implementation of a simple HTTP server in Java, supporting basic requests and binary images.
Basic Info
Statistics
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Java-Web-Server-HTTP-Requests

This is an HTTP server implemented in Java using the native java.net and java.io libraries. It supports HTTP GET, HEAD and DELETE requests from multiple clients through threading, and responses appropriately to connecting clients using the 200 OK, 204 No Content, 404 Not Found and 501 Not Implemented codes. It also supports text files such as text/html and binary images such as images/jpg, images/jpeg, images/png and images/gif. The server logs every request to a .log file. This project was completed for the CS5001 module as a part of my MSc in Artificial Intelligence at the University of St Andrews.
A short report of the advanded requirements can be read here.
Installation
Clone the project:
git clone https://github.com/Adamouization/Java-Web-Server-HTTP-RequestsCd into the directory and compile the files, then run the source code:
cd Java-Web-Server-HTTP-Requests
javac src/*.java src/exception/*.java
Usage
Server
Run the server:
cd src/
java WebServerMain <document_root> <port_number> <max_number_of_active_threads>
where:
* document_root is the root directory from which the server will serve documents.
* port_number is the port on which the server will listen.
* <max_number_of_active_threads> is the maximum number of clients that can connect simultaneously to the server.
Example: java WebServerMain ../www 12345 100
Run the tests (on University machines): stacscheck Tests/
Client
A testing web root directory with html and binary image files is provided in the www directory.
- Terminal
- GET request method
- headers:
curl -s -I -X GET localhost:12345/index.html - text content:
curl -s -X GET localhost:12345/index.html
- headers:
- DELETE request method
- headers:
curl -s -I -X DELETE localhost:12345/delete_me.txt - content:
curl -s -X DELETE localhost:12345/delete_me.txt
- headers:
- 404 Error:
curl -s -X GET localhost:12345/test.html(File not found) - 501 Error:
curl -X SLURP localhost:12345/index.html(POST not implemented)
- GET request method
- Web browser
- Default page (GET):
open http://127.0.0.1:12345/ - Binary image content:
open http://127.0.0.1:12345/stars.gif
- Default page (GET):
Javadocs
Generate the Javadocs:
javadoc -d javadoc src/*.java src/exception/*.javaOpen
javadoc/index.htmlin your web browser.
Contact
- email: adam@jaamour.com
- LinkedIn: www.linkedin.com/in/adamjaamour
- website: www.adam.jaamour.com
- twitter: @Adamouization
Owner
- Name: Adam Jaamour
- Login: Adamouization
- Kind: user
- Location: United Kingdom
- Company: @NewDayTechnology
- Website: www.adam.jaamour.com
- Twitter: Adamouization
- Repositories: 43
- Profile: https://github.com/Adamouization
💻 Data Scientist @NewDayTechnology 🧠 MSc AI @ Uni of St Andrews 📓 BSc Computer Science @ Uni of Bath 💼 Former SWE @ Scuderia Alpha Tauri F1 Team
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0