Also apply the __toString fix to UserInfo
[cacert-mgr.git] / external / ZendFramework-1.9.5 / externals / dojo / demos / offline / editor / server / org / dojo / moxie / Main.java
1 package org.dojo.moxie;
2
3 import javax.servlet.*;
4 import javax.servlet.http.*;
5
6 import org.mortbay.jetty.*;
7 import org.mortbay.jetty.handler.*;
8 import org.mortbay.jetty.servlet.*;
9
10 /**
11 A quick starter class that enables users to run the Moxie
12 server-side extremely quickly. We use the embedded Derby
13 database that comes bundled with Java, coupled with an
14 embedded version of the tiny Jetty embedded web-server.
15
16 @author Brad Neuberg, bkn3@columbia.edu
17 */
18 public class Main{
19 public static void main(String args[]){
20 try{
21 // start our embedded web server, Jetty
22 Server server = new Server(8000);
23
24 // serve up our Moxie/Dojo files
25 ResourceHandler resourceHandler = new ResourceHandler();
26 resourceHandler.setResourceBase("../../../..");
27 server.addHandler(resourceHandler);
28
29 // add the Moxie servlet
30 Context moxieRoot = new Context(server, "/moxie", Context.SESSIONS);
31 Servlet moxieServlet = new MoxieServlet("jdbc:derby:moxie;create=true", null, null,
32 "org.apache.derby.jdbc.EmbeddedDriver");
33 moxieRoot.addServlet(new ServletHolder(moxieServlet), "/*");
34
35 System.out.println("Starting web server on port 8000...");
36 server.start();
37
38 System.out.println("Moxie ready to try on port 8000.");
39 System.out.println("Open a web browser and go to:");
40 System.out.println("http://localhost:8000/demos/offline/editor/editor.html");
41 }catch(Exception e){
42 e.printStackTrace();
43 System.exit(1);
44 }
45 }
46 }