
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 0.78 KB | hits: 8 | expires: Never
import io.mth.foil.j.*;
import javax.servlet.http.*;
import java.io.*;
public class JavaDemo {
private static final Foils f = new DefaultFoils();
private static final Configs c = new DefaultConfigs();
public static class DemoServlet extends HttpServlet {
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String path = req.getPathInfo();
PrintWriter writer = resp.getWriter();
writer.println("hello from " + path);
}
}
public static void main(String[] args) {
Config config = c.compound(
c.servlet("/", "/*", new DemoServlet()),
c.path("/static", "static")
);
Foil foil = f.nu("demo", 10080, config);
foil.run();
}
}