SocketListener listener = new SocketListener(); listener.setPort(port); server.addWebApplication(WEBAPP_CTX, WEBAPP_DIR); server.addListener(listener);
SocketConnector connector = new SocketConnector(); connector.setPort(port); WebAppContext webapp = new WebAppContext(); webapp.setContextPath(WEBAPP_CTX); webapp.setResourceBase(WEBAPP_DIR); server.setHandlers(new Handler[] { webapp }); server.setConnectors(new Connector[] { connector });
    public static void main(String[] args) throws Exception {        int port = PORT;        if (args.length > 0) {            String text = args[0];            port = Integer.parseInt(text);        }        System.out.println("Starting Web Server on port: " + port);        Server server = new Server();        SocketListener listener = new SocketListener();        listener.setPort(port);        server.addWebApplication(WEBAPP_CTX, WEBAPP_DIR);        server.addListener(listener);        server.start();    }