##How to run this Project on your local machine
- Pull the git repository into your local machine
- Install latest gradle version
- go to the project directory where the
gradle.build
file is - run
./gradlew build ; ./gradlew run
command. This should start your server on port 8080. - go to localhost:8080 to see the static page.
- The server is binded to port 8080
- The concurrent request handling capacity depends on the type of machine that the server is run on. In this version it is limited to 4000 concurrent threads.
- The default directory is www which can be seen in the file directory
- All the specifics mentioned above can be modified in the
ServerConfig.java
file
- Request Handling:
- Ability to receive and process HTTP requests (GET, POST, etc.)
- Parse incoming request headers and body
- Response Generation:
- Construct and send HTTP responses with proper status codes and headers
- Serve static files (HTML, CSS, JavaScript, images, etc.)
- Error Handling:
- Generate and send appropriate error responses (404 Not Found, 500 Internal Server Error, etc.)
- Logging:
- Record access logs and error logs
- Configurable log formats and locations
- Request Handling:
- Route requests to appropriate handlers based on URL paths
- Response Generation:
- Generate dynamic content
- Protocol Support:
- Support for HTTP/1.1 at minimum
- Handling of persistent connections (Keep-Alive)
- Content Types:
- Ability to serve different MIME types
- Set appropriate Content-Type headers
- Security:
- Basic authentication support
- HTTPS/TLS encryption (optional for basic, but increasingly important)
- Input validation and sanitization
- Configuration:
- Ability to set port number
- Define document root directory
- Configure virtual hosts (optional for very basic servers)
- Performance:
- Multithreading or asynchronous I/O to handle concurrent connections
- Basic caching mechanisms
- Extensibility:
- Modular design to allow adding new features or handlers
- Standards Compliance:
- Adhere to HTTP specifications (RFC 2616 for HTTP/1.1)
- Directory Listing:
- Option to enable/disable directory listing when accessing a directory without an index file
- Default Documents:
- Ability to specify and serve default documents (e.g., index.html) when accessing a directory
- Basic URL Rewriting:
- Simple rewrite rules for clean URLs or redirects