Question: Build an HTTP server that implements HTTP/1.1 (RFC2616) In Java. https://www.rfc-editor.org/rfc/rfc2616 Rubric: Below include. GET : retrieve static file resource requested. https://www.rfc-editor.org/rfc/rfc2616#page-53 Make sure Content-Type
Build an HTTP server that implements HTTP/1.1 (RFC2616) In Java. https://www.rfc-editor.org/rfc/rfc2616
Rubric: Below include.
GET: retrieve static file resource requested. https://www.rfc-editor.org/rfc/rfc2616#page-53
- Make sure Content-Type is correct.
- Make sure Content-Length is correct.
- Your application should support at least two MIME types.
Example
1. If /example.txt exists, your server responds back with 200 OK, the correct response headers, and the content of that example.txt file in the response body.
2. If /example.txt doesn't exist, your server responds back with an error code.
POST: append the body of the request to the resource. https://www.rfc-editor.org/rfc/rfc2616#page-54
- text/plain types only
PUT: puts the body of the request to the resource. https://www.rfc-editor.org/rfc/rfc2616#page-55
- Creates a new file using the body of the request.
- Overrides the content if the file already exists.
DELETE: delete the resource. https://www.rfc-editor.org/rfc/rfc2616#page-56
Support the right response codes. https://www.rfc-editor.org/rfc/rfc2616#section-10
- Any response code that fits; use your best judgment
OPTIONS: for a given URL, indicate what verbs can be used. https://www.rfc-editor.org/rfc/rfc2616#section-9.2
- GET (always), POST (if the file is a text file), and so on
HEAD: just return the headers for a given URL (no body). https://www.rfc-editor.org/rfc/rfc2616#page-54
HTTP Cats: images as the body of an HTML page sent back with an error code. https://http.cat/
- This is actually quite common for many web servers.
- Only 400s, 500s would need error pages like this.
- The server responds back with HTML containing the correct HTTP Cat image for 400s and 500s status codes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
