rules.put("", new Welcome());
rules.put("another\\.html", "examples.pages.Another");
rules.put("slow\\.html", "examples.pages.Slow");
rules.put("pages/(.*)", "examples.pages.dispatch.$1");
rules.put("secret/(.*)", new AuthenticationProducer(new Another(), "myuser", "mypass", "Top Secret Area"));
rules.put("breakme", new DocumentProducer()
{
public void produceDocument(Request request, Response response) throws Exception, Redirection
{
throw new Exception("You broke Kitteh!");
}
});
DocumentProducer f = new FileProducer("www");
DocumentProducer d = new DispatcherProducer(rules, f);
WebServer w = new WebServer(d,8080);
w.runAsThread();
System.out.println("Server started!");
System.out.println("Press ENTER to quit.");