Write a toy version of an http server. It should accept requests of the form:
http://marlowe:33201/Foobar/MyTest
In response to this request, the server should create an instance r of the class Foobar, invoke r.setArg("MyTest"), invoke r.setOutputStream(...) with the output stream for the http request, and then invoke new Thread(r).start().
Alternatively, if you want to do a slightly simpler version of the project, just invoke r.run() rather than creating a thread. If you don't create threads, you don't have to worry about synchronization. If you do the non-threaded version of the project, there is a 10 point deduction from your grade (bugs in your use of threads could cost you more than 10 points, so perhaps trying a non-threaded version first is a good idea).
The port your server listens on should be taken from the command line. To avoid conflicts, when testing you should use a port number calculated from your account number as port 332xx, where xx is your account number. For example, if your account is as43317, listen to port 33217.
The server objects which can be used must all implement the interface:
public interface MiniServlet extends Runnable {
void setArg(String arg);
void setOutputStream(java.io.OutputStream out);
}
The servlets should be loaded dynamically (using Class.forName(...)).
We've provided you with some classes:
Note that we will test your MiniServlets using our web server, and your webserver using our MiniServlets.
You also need to write some servlets:
We've made a server available on port 33101 of savoir.cs.umd.edu. Here are some sample queries:
Note: RawProxy shows you the http headers returned by a request. You don't have to implement RawProxy.