This project is an implementation of a basic HTTP Server built with Java.
The HTTP Server supports the following:
- HTTP Methods: simple GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS.
- Decoding Parameters
- Basic Authentication
- Basic Cookie Implementation (Setting a cookie on the client side)
- The server can serve txt, jpeg, png, and gif files.
- Range request can be made to get partial content from a txt file
Clone this repository to your local machine
$ git clone https://github.com/portatlas/httpserver.git
$ cd httpserver
Run the following command to run the unit tests:
$ mvn test
The acceptance test and instructions to run them can be found here
At the root dir run the command:
$ mvn package
At the root directory run the command:
java -jar target/httpserver-1.0.jar -p 5000
Where:
-p is the port
-d is the resource directory (if a directory argument is not supplied the server will default to the public directory in the repo)
You should see the port and directory displayed to the console.
When a HTTP request is made to the server you should be able to see the response on the console.
Additionally, you can go to http://localhost:5000 on your browser and interact with the server there.