CS4025 Assignment 1

 

Due: Thu., Jan. 31, 2008

 

1.     Write a simple Java program to experience the HTTP protocol using Java URL-based networking API.

 

To learn how to use Java URL-based networking, read the online Java Tutorial and Java URL-based network API (java.net.*).

 

The program asks the user to input the following information:

 

1.     Protocol (default: http)

2.     Full domain name (e.g. www.cs.unb.ca)

3.     Document path (e.g. /profs/wdu/cs4025/index.html)

4.     Port number (default: 80)

 

The program creates a URL based on the user input information and makes an HTTP request to the corresponding web server. The program displays the HTTP response from the web server on screen up to the blank line. Then the program saves the HTML source file sent by the server to a file.

 

Try to test the program by accessing different web sites with existing or non-existing web pages. Use a web browser to verify if the saved HTML files are correct by comparing them with directly connecting to the web servers using the URLs.

 

Write the program in a single Java file that can contain one or more classes.

 

Name the Java source code file as “CS4025q1a.java” and submit the file online through CS4025 course web site.

 

2. In this question, you will create a static website for displaying assignment mark information for a professor. The website should display assignment mark information for 5 or more courses, and for each course there are 5 or more students and 5 or more assignments. The content of the website can be fictional. The following is the technical requirements:

 

o      Image (e.g. UNB logo)

o      Hyperlink (use relative link)

o      List (unordered or ordered)

o      Table

 

Name the entry page of the website as “index.html”.

 

The following is the information for you to deploy, i.e. submit, your website on our web server by the due day.

·       The URL of the web server is “isel.cs.unb.ca”

·       Your login id on the server is your last name followed by the first letter of your first name or middle name, e.g.  duw.

·       The current password of your account is “cs4025” for CS4025 students and “cs6095” for CS6095 students.

After you first login, you should change your password using the command “passwd”.

·       Use SSH to login to the server. For PC user, download, install, and use “putty” software, which can be downloaded from CS4025 course website.

·       After you login, create a sub-directory named “public_html” under your home directory.

·       Create a sub-directory named “a1” under the public_html directory.

·       To deploy your web pages, you can ftp the XHTML files to the public_html/a1 directory on the server. If your website has its own directory hierarchy, create the hierarchy under public_html/a2 directory, using command “mkdir directory-name”.

·       Please make sure the public_html directory and all sub-directories as well as all files in those directories are public-readable. To check this, enter “ls –l” in each directory. You should see:

drwxr-xr-x      directory-name

-rw-r--r--         file-name

·       To see your deployed web site, enter the following URL in a web browser

http://isel.cs.unb.ca/~your-login-id/a1/entry-page-of-your-website