Starting from:

$30

CSE471-Labwork 1 Solved

Below, you can find the description of your labwork for today.  You are required to develop a Java application to save image files from a web server and check if it is modified or not. In order to do so, you will use the given HTMLTest class and modify the code. 

 For the part 1, in the given HTMLTest class, you are required to extract the payload image file and save it as image.jpg.  

 For the second part, you need to make sure that the image.jpg file is not changed by checking the If-Modified-Since header field in the HTTP protocol. To achieve this, first, you should store the header and data bytes separately. Next, you should find the value corresponding to the “Last Modified: “field in the header. Then, you should create a new HTTP request consisting of the stored value for the “If-Modified-Since: ”field.  If the file is not modified, print on the console “File is up-to-date”. 

Note: Before testing your program, you should download the zero tier from https://www.zerotier.com/. When you run the installed program, choose Join network and type 12ac4a1e71d65a30 to related field. 

Online participants should use the below URL when testing their application:  

http://172.30.122.241:8080/3dsk4fsljnw4.jpg 

In-class users should use the below URL when testing their application: 

http://10.2.10.202:8080/3dsk4fsljnw4.jpg 

 

Application Walkthrough 

Please Enter the URL address of the web page: http://172.30.122.241:8080/3dsk4fsljnw4.jpg 

GET /3dsk4fsljnw4.jpg HTTP/1.1 

Host: 172.30.122.241 

Connection: close 

 

HTTP message for if-modified-since:  

GET /3dsk4fsljnw4.jpg HTTP/1.1 

Host: 172.30.122.241 

Connection: close 

If-Modified-Since: Wed, 02 Oct 2019 12:49:29 GMT 

 

 

Received header:  

HTTP/1.1 304 Not Modified 

Date: Fri, 05 Nov 2021 12:52:03 GMT 

Server: Apache/2.4.38 (Debian) 

Connection: close 

ETag: "2e017-593ece6508b67" 

 

File is up-to-date 

More products