ajaynegi45 / Http-Server

A lightweight, custom HTTP server built in Java that handles basic GET requests and supports multithreaded request handling. It’s easy to extend for additional HTTP methods and ideal for learning the fundamentals of server-side programming.
7 stars 15 forks source link
hackoctoberfest2024 hacksquad hacktoberfest hacktoberfest-accepted http http-server java springboot webserver

Own HTTP Server

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.

Table of Contents

Key Features

Core Components

How It Works

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.

Main Components

  1. ServerListenerThread: Listens for incoming connections and creates new worker threads for each request.
  2. HttpConnectionWorkerThread: Handles the actual processing of the HTTP request, including parsing and responding.
  3. HttpParser: Parses incoming HTTP requests, handling the method, headers, body, and version.
  4. ConfigurationManager: Manages server configuration, such as port number and webroot directory.
  5. HttpRequest: Represents the parsed HTTP request, including method, headers, body, and version.

Flow Diagram

Diagram

How to Contribute to this Project

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:

Acknowledgements

This project wouldn't be possible without the contributions of our amazing community. Thank you for being part of our journey! 🙌