Giter Site home page Giter Site logo

java-http-server's Introduction

Java HTTP Server

Objectives

Installation

Requires Java 1.8 and Maven

1. Set the following environment variable:

export JAVA_SERVER_TOKEN='Basic YWRtaW46aHVudGVyMg=='

2. In your terminal, kill process on port 5000:

kill -9 `lsof -i :5000 | tail -1 | awk '{print $2}'`

3. Clone, compile, and package the code:

$ git clone https://github.com/malinatran/java-http-server
$ cd java-http-server
$ mvn package

Run

From the root directory, run java -jar target/java-http-server-1.0-SNAPSHOT.jar.

To specify a port and/or directory, you may pass in the following arguments: -p [PORT] -d [DIRECTORY], -p [PORT], or -d [DIRECTORY]. The port and directory are optional; if not provided, default values for both will be set (to port 5000 and public directory, respectively).

Tests

JUnit is the unit testing framework used for this project. Through the command line, run mvn test. For acceptance tests via Cob Spec, run the server and follow instructions listed here.

Codebase

Package Purpose
mocks (test folder) Includes mock objects for testing
reader Reads from input stream
request Parses incoming requests to build request objects
resource Has logic for handling resources
response Formats and builds response objects
routing Determines action by request type
setup Handles command-line UI and sets up configuration
utility Includes helper objects and constants
writer Writes to output stream

More details about how the code is organized here.

Contact

๐Ÿš€ Make a pull request, submit an issue, or contact me @malinatran.

java-http-server's People

Contributors

malinatran avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.