This repository contains a simple HTTP server implementation in Java.
- Supports HTTP methods: GET, POST, PUT, DELETE
- Serves static files with correct MIME types
- Handles various content types: HTML, text, images, PDF, etc.
- Provides basic error handling and status code responses
Represents an incoming HTTP request, parsing method, path, and HTTP version.
Constructs and sends HTTP responses with appropriate headers and content.
Defines the contract for handling HTTP requests based on different methods.
Serves static files from a specified directory, determining content types based on file extensions.
Handles incoming client connections, delegates requests to appropriate handlers (HTTPHandler
), and manages response generation.
To use the HTTP server:
- Clone the repository.
- Change The rootDirectory on HttpServer.java
- Compile the Java classes (
javac *.java
). - Run the (
java HTTPServer
) . - The server serve on port 1202 .