For this problem set you will build a simple web-based application from scratch. You will do it in stages:
GET
command as well as
cookies. Unlike a regular webserver, yours will not fetch
files from the file system, instead you will simply return the
same message as long as the client does not request
/cookies
. You will also set a different cookie
for each client connection, following the cookie
specification. If the client does ask for
/cookies
you will then return the list of
cookies you have set for that client. You should be able to
test your server with any web browser that supports cookies.
/getdoc/<docnumber>
, where
docnumber
is the number of the requested
document. What these documents contain is not important, just
make sure that they are in HTML and contain their
docnumber
.
Whenever a client asks for a particular document, your sever
will remember that. Then, whenever a client asks for
/status
, you will return an HTML page that
lists all the documents and tells the client which one he
has and has not read. Your server should be able to perform
this task for several "simultaneous" clients. You should
test this with two or three clients each running on a
separate machines, or with different browsers on the same
machine.
Finally, when anyone asks for /state
you will
return a list of all the past client connections and the set
of documents each one of them has read.
/addhost/<hostname>:<port>
tells your server to remember that there is another server
running at hostname:port
. Using this information,
when a client requests /netstate
you will
dynamically query all those other servers for their
/state
, and return all that information, along
with your own state information, to the client.
Handing it in: As will all the problem sets, you will hand them in using our department's dropbox, at this link. You will hand in all your javadoc-commented java files. You will be graded on your (lack of) documentation. You will also include a README file that gives step-by-step instructions on how to run your program. Remember that the harder you make it for us to run your program, the more annoyed we will be when grading it. You must use the sample README.txt as your template. Failure to follow any of these rules will result in a 50% penalty.