| CS 455/555 - Intro to Networks and Communications
Fall 2009: Tues/Thurs 3-4:15pm, Spong 0108 |
|
Staff
Syllabus (pdf) |
Program 1b: URL ParserAssigned: Thursday, September 17, 2009
BackgroundYour program will take a URL as its only command-line argument. The URL will be given in the following format: hostname - the web server's hostname :port - an optional command that tells the web client to connect to a different port than the default of port 80 path - the path from the web server's main directory to the requested file, if this is not present, then the path is '/' URL Examples:
The hostname is shown in bold font, and everything after (and including) the first '/' following the hostname is part of the path. Requirements
Rules
TestingYour program will be graded on how well it satisfies the requirements in handling a set of test URLs. You should test your program rigorously with various URLs before submitting. Because your programs will be run and tested using a script, you must format your output exactly as I have described or you will lose points. Example 1 % java UrlParser http://www.cs.odu.edu/~mweigle/files/foo.txt http://www.cs.odu.edu/~mweigle/files/foo.txt www.cs.odu.edu 80 /~mweigle/files/foo.txt Example 2 % java UrlParser http://www.amazon.com:4567/Harry_Potter/this/is/a/book.html http://www.amazon.com:4567/Harry_Potter/this/is/a/book.html www.amazon.com 4567 /Harry_Potter/this/is/a/book.html Example 3 % java UrlParser http://www.amazon.com http://www.amazon.com www.amazon.com 80 / Example 4 % java UrlParser http://www.amazon.com/ http://www.amazon.com/ www.amazon.com 80 / Example 5 % java UrlParser Usage: java UrlParser URL Example 6 % java UrlParser amazon.com Error: improper URL format SubmissionYou must name your source file UrlParser.java. Make sure that you submit all files necessary to compile your program. But, do not submit compiled files (.class files). Directions for submitting your assignment through Blackboard |