import org.mortbay.http.*; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.*; import org.mortbay.log.*; public class ServletServer { public static void main(String[] args) throws Exception { String DOC_ROOT = args[0]; Server server = new Server(); server.addListener(":8080"); // logging server.setRequestLog(getServerLogging()); ServletHttpContext context = (ServletHttpContext) server.getContext("/"); // Servlets context.addServlet("Invoker","/servlet/*", "org.mortbay.jetty.servlet.Invoker"); // HTTP server.addWebApplication("/", DOC_ROOT); server.start(); } private static RequestLog getServerLogging() throws Exception { NCSARequestLog a = new NCSARequestLog("./request.log"); a.setRetainDays(90); a.setAppend(true); a.setExtended(false); a.setLogTimeZone("GMT"); a.start(); return a; } }