Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import io.mth.foil.j.*;
  2. import javax.servlet.http.*;
  3. import java.io.*;
  4.  
  5. public class JavaDemo {
  6.     private static final Foils f = new DefaultFoils();
  7.     private static final Configs c = new DefaultConfigs();
  8.  
  9.     public static class DemoServlet extends HttpServlet {
  10.         protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  11.             String path = req.getPathInfo();
  12.             PrintWriter writer = resp.getWriter();
  13.             writer.println("hello from " + path);
  14.         }
  15.     }
  16.  
  17.     public static void main(String[] args) {
  18.         Config config = c.compound(
  19.             c.servlet("/", "/*", new DemoServlet()),
  20.             c.path("/static", "static")
  21.         );
  22.         Foil foil = f.nu("demo", 10080, config);
  23.         foil.run();
  24.     }
  25. }