25.12.2017

Project: "Simple HTTP Server"

#JavaSE #JavaIO #Maven #Log4J

Console application for studying operations of the HTTP protocol.


The server can return various static resources on request e.g: html pages, images, JavaScript scripts and CSS tables.

How to use this application:

  1. Download the archive with application.
  2. Unzip the archive.
  3. Put your "index.html" and other resources in the directory "WWW".
  4. Run the file "start.cmd".

How to build this project:

  1. Download the source code or clone the repository (stable branch is master).
  2. Install project builder Maven and JDK 8.
  3. Run the command "mvn package" in the root of the project.
  4. The directory "target" appears in the project root, and will contain the file "simple-http-server.jar". This is the executable file.
  5. The application will not work without some things:
    • Directory "WWW" next to "simple-http-server.jar" file.
    • Directory"resources" next to "simple-http-server.jar" file with:
      • Configuration file "configuration.properties", containing all properti(read the section "Properties")
      • Directory "errors" whit html page for error. (400.html, 404.html, 500.html)
  6. The application is launched by the command "java -jar simple-http-server.jar"

Properties:

timerIsON = [true | false] - Switch for server timer.
timerTime = [from 1 to 153722867280911] - Time for timer, in minutes
port = [8080] - Port on which the requests will be expected

Technologies:

  • HTTP
  • Java 8
  • Properties
  • Log4j
  • Maven
  • JUnit