Programming Assignment 3.
This assignment is to be done either individually or in
pairs. Do not show your code to any other group and do not look at any other
group's code. Do not put your code in a public directory or otherwise make it
public. However, you may get all the help you need from the TAs or the
instructor. You are encouraged to use the WebCT Discussions page to post
problems so that other students can also see the answers.
The objectives of this assignment are:
- To gain an understanding of how some of the common Internet application
protocols are designed,
- To be familiar with how standard protocols are specified in RFCs, and
- To understand how HTTP and SMTP protocols work and implement them
according to their respective RFCs.
In this assignment, you need to implement a multi-threaded HTTP
server and an SMTP client. Your HTTP server should implement both the GET and
POST methods and should support the following functionalities:
- Your server should support a root and should dynamically generate a
default index HTML file and an email form web page when a browser requests one
of these files . The index page should have three different links. One
pointing to the course web page, one pointing to one of your favorite web
sites, and one pointing to the email form web page.
- If the user presses on the email form link, the HTTP server will respond
by producing the email form page. This latter will have the following fields:
- a (From:) field to hold the email address of the sender,
- a (TO) field to hold the email address of the receiver,
- a (SUBJECT) field to hold the email subject,
- a (BODY) field to hold the email body,
- a (SEND) command button, and
- a (SMTP SERVER) field which users can optionally fill to designate a
specific SMTP server to use. If this field is not filled, your SMTP client
should be able to use a default server.
- If the user presses the SEND button, The POST method will be used in
this case to send the SMTP request to the HTTP server. This latter will then
forward the request received to the SMTP client who will take care of sending this email message
to its destination.
- If the server receives an empty request, he should respond by producing
the index page.
Both the index page and the email form page should be dynamically generated
by your HTTP server using HTML. You should not use any external HTML files for
these pages or any other HTML page for this assignment.
Your should work with
browsers that are HTTP/1.0 compliant.
You should not use servlets or any existing SMTP or HTTP classes in this this assignment.
Your program should take a command line argument specifying what is the port
number it will use.
All exceptions must be properly handled.
Completion of one of this extensions will result in a better grade; however,
groups of more than one person MUST complete this extension to receive a full
grade. It should also be noted that, if you have an idea for a different
extension, ask either the instructor or TAs for approval:
- Enhance your SMTP client to support attachments
- Support default values in the email form page. The default values should
be passed from the client as parameters using the GET method and a properly
URL-encoded string as attachment.
- Implement an interface between your HTTP server and the calendar
application you have implemented in PA2.
Grading will be split in the following way:
- 60% correctness (Does it do what it's supposed to?)
- 20% error handling (Can it easily be crashed?)
- 20% documentation (Is it easy to read and understand the code?)
The due date for this project is October 1st, 2002, 11:55pm EST. You
should use the assignments drop-off box located at the course's WebCT page.
Upload a JAR file containing all the relevant documented Java files,
along with a README file describing the project and its usage.
- 10% penalty for a one-day late submission.
- 25% penalty for up to a three-day late submission.
- Submissions more than 3 days late will not be accepted.