1 18 19 package org.apache.activemq.web.tool; 20 21 import org.mortbay.jetty.Connector; 22 import org.mortbay.jetty.Handler; 23 import org.mortbay.jetty.Server; 24 import org.mortbay.jetty.nio.SelectChannelConnector; 25 import org.mortbay.jetty.webapp.WebAppContext; 26 27 28 33 public class Main { 34 35 public static final int PORT = 8080; 36 37 public static final String WEBAPP_DIR = "src/main/webapp"; 38 39 public static final String WEBAPP_CTX = "/"; 40 41 public static void main(String [] args) throws Exception { 42 int port = PORT; 44 if (args.length > 0) { 45 String text = args[0]; 46 port = Integer.parseInt(text); 47 } 48 System.out.println("Starting Web Server on port: " + port); 49 Server server = new Server(); 50 SelectChannelConnector connector = new SelectChannelConnector(); 51 connector.setPort(port); 52 connector.setServer(server); 53 WebAppContext context = new WebAppContext(); 54 55 context.setResourceBase(WEBAPP_DIR); 56 context.setContextPath(WEBAPP_CTX); 57 context.setServer(server); 58 server.setHandlers(new Handler[]{context}); 59 server.setConnectors(new Connector[]{connector}); 60 server.start(); 61 62 System.out.println(); 63 System.out.println("=============================================================================="); 64 System.out.println("Started the ActiveMQ Console: point your web browser at http://localhost:" + port + "/"); 65 System.out.println("=============================================================================="); 66 System.out.println(); 67 } 68 } 69 | Popular Tags |