Web-Server
Project Description
Project information
- Category: Client-Server Architecture
- Programming Language: Java, JavaFx, HTML
- Project Type: Sole project
- GitHub URL: https://github.com/Isuranga-Seram/Web-Server-Simple.git
Applications Used
Java
JavaFx
Scene-builder
HTML
Introduction about the "Web-Server Application"
This project is a lightweight web server implemented in Java using core networking libraries. It listens for incoming HTTP requests on port 80 and processes them using multi-threading to handle multiple client connections concurrently.
Features of the Web-Server-App 🚀
- 1️⃣ Basic HTTP Request Handling – Accepts and processes client requests over port 80.
- 2️⃣ Multi-threaded Processing – Uses threads to handle multiple client connections concurrently.
- 3️⃣ Client-Server Architecture – Acts as a server, responding to requests from web browsers or API clients.
- 4️⃣ Socket-Based Communication – Utilizes Java’s ServerSocket & Socket API for networking.
- 5️⃣ Efficient Request Reading – Uses BufferedReader & InputStreamReader to handle incoming data.
- 6️⃣ Logging & Monitoring – Displays client connection details in the console.
- 7️⃣ Lightweight & Fast – Minimal dependencies, making it efficient and easy to deploy.
- 8️⃣ Extensible – Can be modified to support file serving, REST API requests, or WebSockets.
Technologies Used 👩🏻💻
- Java: Core language for backend development.
- ServerSocket & Socket: Manages client connections.
- Multi-threading: Handles multiple requests concurrently.
- BufferedReader & InputStream/OutputStream: Reads/Writes client requests efficiently.
- HTTP Request Handling: Processes incoming HTTP requests.
Client-Server Architecture
This web server follows a client-server model, where:
- The server (ServerSocket) listens on port 80 for incoming connections.
- A client (e.g., browser, Postman, or curl) initiates an HTTP request.
- The server accepts the connection and spawns a new thread to handle the request.
- The server reads the HTTP request headers from the client using BufferedReader.
- (Optional) It can process different HTTP methods (GET, POST, etc.).
- Once processing is complete, the server sends back an HTTP response and closes the connection.
Built With 🛠️
The Web-Server App was developed only using the Java language.
Getting Started
Ensure your IDE or code editor is set up properly. Basic networking knowledge is beneficial:
- Understanding Domain Name System (DNS).
- How HTTP Requests/Responses work.
Installation 💻
Visit my GitHub profile and Clone the project first
git clone https://github.com/Isuranga-Seram/Web-Server-Simple.git
cd Web-Server-Simple
Change git remote URL to avoid accidental pushes:
git remote set-url origin github_username/repo_name #optional
git remote -v # confirm the changes
If 'Apache2' is running, stop it first:
sudo systemctl stop apache2
Install Maven if not installed:
sudo apt update
sudo apt install maven -y
Run the server on Port 80:
mvn -q compile && sudo /opt/sdkman/candidates/java/current/bin/java -cp target/classes
lk.ijse.dep13.web.server.ServerApp
Usage
The Web-Server app can be used for:
- 🌐 Basic Web Server – Serves static files (HTML, CSS, JS).
- 📡 API Server – Handles REST API requests (GET, POST, etc.).
- 🛠 Testing & Learning – Understand network programming, multi-threading, and HTTP requests.
- 📂 Local File Sharing – Share files over a local network.
- 📚 Educational Tool – Learn about sockets and HTTP headers.
Get in touch
Have an idea for a project? Let’s turn it into reality! Contact me here, and let’s get started.Find Me
Email: isurangaseram@gmail.com
LinkedIn: linkedin.com/in/isuranga-seram
Tel: +94 71 8816464