1. Download http://www.cse.chalmers.se/EDU/dkom/Assignments/Assignment1/WebServer.java http://www.cse.chalmers.se/EDU/dkom/Assignments/Assignment1/WebServerTest.java Store the files in a directory named Assignment1 2. Run the tests with >cd Assignment1 >javac WebServer.java >javac WebServerTest.java >java WebServer & Port number is: <## Paste ##> >java WebServerTest -p <## Copy ##> Please note that the string <####> above relates to a number (the port number) that you should copy from <## Paste ##> to <## Copy ##>. It will connect to the server at localhost:<####> and perform a set of test requests. It does not analyze whether the responses are correct or not, so that is up to you to do. You can specify the use of another port by supplying the argument -p . The result should be a test execution of the skeleton program WebServer. You should modify the file WebServer.java to meet this assignment specification. 3. Compare your program behavior with the following expected output: ----------------------------------------------- Testing methods on valid resource ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: GET /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:14:21 CEST 2011 Location: /index.html Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 402 Content-Type: text/html Last-Modified: on, 12 okt 2011 17:01:25 +0200 Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: HEAD /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:14:21 CEST 2011 Location: /index.html Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 402 Content-Type: text/html Last-Modified: on, 12 okt 2011 17:01:25 +0200 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: POST /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 501 Not Implemented Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: BLAHA /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: GET /empty.txt HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:14:21 CEST 2011 Location: /empty.txt Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 0 Content-Type: application/octet-stream Last-Modified: on, 12 okt 2011 17:02:33 +0200 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: HEAD /empty.txt HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:14:21 CEST 2011 Location: /empty.txt Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 0 Content-Type: application/octet-stream Last-Modified: on, 12 okt 2011 17:02:33 +0200 ----------------------------------------------- ----------------------------------------------- Testing methods on invalid resource ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: GET /nonexisting.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 404 Not Found Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: HEAD /nonexisting.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 404 Not Found Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: BLAHA /nonexisting.html HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ----------------------------------------------- Testing illegal request lines ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: GET this_is_actually_illegal HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ---------------------------------------------- ---------------------------------------------- > Sending request: GET HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- > Sending request: GET /index.html > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- > Sending request: GET/nonexisting.htmlHTTP/1.0 HTTP/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- > Sending request: GET /index.html HTTP/1.0 FLEBHL > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- > Sending request: HEAD /index.html FLEBHL HTTP/1.0 > Received response: HTTP/1.0 400 Bad Request Date: Wed Oct 12 17:14:21 CEST 2011 ----------------------------------------------- ----------------------------------------------- Testing concurrent requests and content types ----------------------------------------------- R4: > Sending request: GET /pic.bin HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 404 Not Found Date: Wed Oct 12 17:14:21 CEST 2011 R3: > Sending request: GET /pic.png HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:14:21 CEST 2011 Location: /pic.png Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 980 Content-Type: application/octet-stream Last-Modified: on, 12 okt 2011 17:10:36 +0200 ‰PNG _ _ €_ R2: > Sending request: GET /pic.gif HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:24:02 CEST 2011 Location: /pic.gif Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 934 Content-Type: image/gif Last-Modified: on, 12 okt 2011 17:22:46 +0200 GIF89a;_dgf R1: > Sending request: GET /pic.jpg HTTP/1.0 User-Agent: WebServerTest/1.0 > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:24:02 CEST 2011 Location: /pic.jpg Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 1059 Content-Type: image/jpeg Last-Modified: on, 12 okt 2011 17:22:57 +0200 ÿØà ----------------------------------------------- Testing conditional GET ----------------------------------------------- > Sending request: GET /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 If-Modified-Since: Mon, 12 Jul 2004 10:19:04 GMT > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:24:02 CEST 2011 Location: /index.html Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 402 Content-Type: text/html Last-Modified: on, 12 okt 2011 17:01:25 +0200 Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. > Sending request: GET /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 If-Modified-Since: on, 12 okt 2011 15:23:57 GMT > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:24:02 CEST 2011 Location: /index.html Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 402 Content-Type: text/html Last-Modified: on, 12 okt 2011 17:01:25 +0200 Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. > Sending request: GET /index.html HTTP/1.0 User-Agent: WebServerTest/1.0 If-Modified-Since: Mon, 12 Jul 2006 10:19:04 GMT > Received response: HTTP/1.0 200 OK Date: Wed Oct 12 17:24:02 CEST 2011 Location: /index.html Server: WebServer/1.0 Allow: GET, HEAD Content-Length: 402 Content-Type: text/html Last-Modified: on, 12 okt 2011 17:01:25 +0200 Volcano Web In this lesson you will use the Internet to research information on volcanoes and then write a report on your results. -----------------------------------------------