Question: please guys im stuck with question can i get help its about server in java Problem 1 Implement a simple web server that accepts multiple

please guys im stuck with question can i get help its about server in javaplease guys im stuck with question can i get help its aboutserver in java Problem 1 Implement a simple web server that accepts

Problem 1 Implement a simple web server that accepts multiple client connections on some port (e.g., 8888) using the serverSocket class. The server should serve (at least) HTML and PNG files from a local directory, using the GET method in the HTTP protocol. The response from the server should include correct and relevant headers as well as the requested file. The server should run until you terminate it (ctrl- cor ctrl-d keyboard shortcut). o o Two program arugments The port Path to /public directory. This of this folder as the serving directory from which our web- server will serve html files and images. Accessing http://yourip:port/shrek.html will serve a file from your_project_folder/public/shrek.html. Start by implementing a server that accepts connections and returns a predefined (valid) HTTP/HTML response. Once you can connect to the server with a web browser and view the predefined HTML page, you should add support for reading HTML files from disk and returning these. Finally, add support for images (binary files). If a user requests a specific directory, e.g. / or user1/pages and this directory contains index.html file, then this file should be returned. Note that the ending / is optional, so http://myserver.com/userl and http://myserver.com/useri/ should both return the index.html file in the userl directory. Prepare a few HTML and PNG files in a directory hierarchy (e.g. /memes/rarepepe.png) and use this to test your web server. Make sure to include both index.html files as well as other named HTML files, e.g., myfile.html Your report should include screenshots of the browser window when you request a named HTML page, an image, and a directory (with an index.html file). Your web server should be robust you have to handle possible exceptions. -- . Document which exceptions you handle. Note*: You are not allowed to use third-party libraries or existing Java classes (such as com.sun.net.httpserver ) since these make the problem trivial. Hint: You can reuse your code from the first assignment. Hint: You can use the provided test script to check if your implementation works as expected. Problem 1 Implement a simple web server that accepts multiple client connections on some port (e.g., 8888) using the serverSocket class. The server should serve (at least) HTML and PNG files from a local directory, using the GET method in the HTTP protocol. The response from the server should include correct and relevant headers as well as the requested file. The server should run until you terminate it (ctrl- cor ctrl-d keyboard shortcut). o o Two program arugments The port Path to /public directory. This of this folder as the serving directory from which our web- server will serve html files and images. Accessing http://yourip:port/shrek.html will serve a file from your_project_folder/public/shrek.html. Start by implementing a server that accepts connections and returns a predefined (valid) HTTP/HTML response. Once you can connect to the server with a web browser and view the predefined HTML page, you should add support for reading HTML files from disk and returning these. Finally, add support for images (binary files). If a user requests a specific directory, e.g. / or user1/pages and this directory contains index.html file, then this file should be returned. Note that the ending / is optional, so http://myserver.com/userl and http://myserver.com/useri/ should both return the index.html file in the userl directory. Prepare a few HTML and PNG files in a directory hierarchy (e.g. /memes/rarepepe.png) and use this to test your web server. Make sure to include both index.html files as well as other named HTML files, e.g., myfile.html Your report should include screenshots of the browser window when you request a named HTML page, an image, and a directory (with an index.html file). Your web server should be robust you have to handle possible exceptions. -- . Document which exceptions you handle. Note*: You are not allowed to use third-party libraries or existing Java classes (such as com.sun.net.httpserver ) since these make the problem trivial. Hint: You can reuse your code from the first assignment. Hint: You can use the provided test script to check if your implementation works as expected

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!