01: /*
02: * Created by IntelliJ IDEA.
03: * User: sg426575
04: * Date: May 15, 2006
05: * Time: 12:41:45 PM
06: */
07: package com.technoetic.xplanner.webservers;
08:
09: import java.io.File;
10:
11: import org.mortbay.http.HttpServer;
12: import org.mortbay.http.SocketListener;
13: import org.mortbay.jetty.Server;
14: import org.mortbay.jetty.servlet.WebApplicationContext;
15: import org.mortbay.stop.Main;
16: import org.mortbay.start.Monitor;
17:
18: public class JettyServer {
19: public static void main(String[] args) throws Exception {
20: start();
21: }
22:
23: public static void start() throws Exception {
24: HttpServer server = new Server();
25: SocketListener listener = new SocketListener();
26: listener.setPort(8080);
27: server.addListener(listener);
28:
29: WebApplicationContext context = new WebApplicationContext("war");
30: context.setContextPath("/xplanner");
31: context.setTempDirectory(new File("build"));
32: context.setIgnoreWebJetty(true);
33: server.addContext(context);
34:
35: Monitor.monitor();
36:
37: server.start();
38: }
39:
40: public static void stop() {
41: Main.main(null);
42: }
43: }
|