This project implements a lightweight and highly scalable HTTP server written in Java. It aims to handle basic HTTP requests and responses while providing an easily extensible and customizable architecture.
The HTTP server is designed with performance, security, and simplicity in mind. It supports the most common HTTP methods like GET, POST, PUT, DELETE, and more, allowing developers to add new features or extend functionality without modifying the core structure.
Our primary goal is to keep this server lightweight and efficient, ensuring minimal resource usage without sacrificing functionality.
Configuration : Manages server configuration such as the port number and web root directory. The Configuration
class allows you to specify parameters at runtime, enabling flexible deployment options.
HTTP Methods : The server supports various HTTP methods, making it a fully functional HTTP server capable of handling:
Request Parsing : The HttpParser
class is responsible for parsing incoming HTTP requests, including headers, methods, body content, and request targets. It ensures that the requests conform to the correct HTTP version and structure.
Threading for Performance : Each incoming request is handled in a separate thread (HttpConnectionWorkerThread
), ensuring that the server can handle multiple clients at once without blocking.
Error Handling : Custom exceptions such as HttpConfigurationException
, HttpParsingException
, and BadHttpVersionException
are used to handle various error scenarios gracefully, ensuring the server can recover or return appropriate error responses.
JSON Utilities : The Json
utility class simplifies JSON handling, allowing easy conversion between Java objects and JSON format. This is particularly useful for building APIs that need to return JSON responses.
Extensibility : This server is designed with extensibility in mind. You can add custom HTTP methods, modify the request handling, or implement new features without affecting the existing codebase. This makes it perfect for projects that require custom handling of HTTP requests.
The server listens for incoming connections on a specified port (default is 8080
). When a client sends a request, the server parses the HTTP request, checks its validity, and responds accordingly. Each connection is handled in a separate thread, allowing multiple clients to interact with the server concurrently.
We welcome contributions! Before you start, please read the Contributing Guidelines file, which contains important guidelines to make the contribution process smoother, especially for newcomers. Here's a quick overview:
Clone the repository
git clone https://github.com/ -yourusername- /Http-Server.git
cd Http-Server
This project wouldn't be possible without the contributions of our amazing community. Thank you for being part of our journey! 🙌