Code Monkey home page Code Monkey logo

http-server's Introduction

Assignment: HTTP

Instruction: 
    The program has been packaged as HTTP.jar which has been put at the top of 
the folder, and the source codes are in the "src" folder. The server is developed using JAVA in 
IDEA platform.
    Starting the server only needs to directly input the command "java -jar HTTP.jar" in cmd,
then the HttpServer and HttpsServer will be launched respectively. The HttpServer is set up at 
port 8081 and HttpsServer is at port 8082. 
    Using the command "curl http://localhost:8081/add/7/8"
			or
"curl.exe -XPOST --data "{'operation': 'divide', 'arguments':[4.0,3.0]}" http://localhost:8081"
can test the server, the same in HttpsServer replacing "http" with "https", then the response result 
will be shown.
    
    As for HttpsServer, the server.p12 is the keystore of the server in PKCS12 and the server.cer is 
the certificate exported by it, the same in client.p12 and client.cer. The client certificate has 
been imported into the server keystore becoming trusted.

    When using the GET method to request the HttpServer, the URL in the wrong form will lead to 
the error status code such as 404 Not Found in the wrong arithmetic method, 400 Bad Request 
in the bad syntax of arguments, and so on. Using the POST method, the tag name "operation" and 
"arguments" (not case sensitive) need to be correct, or the exception and error status code will be 
triggered during conversion to JSON. The SSL is introduced in HttpsServer, others are the same 
with HttpServer. The server keystore is set to be loaded in the current folder.



http-server's People

Watchers

Luyang Li 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.