手动启动jetty

public class Main {

    public static void main(String[] args) throws Exception {
        Server server = new Server(8080);

        WebAppContext context = new WebAppContext();
        context.setDescriptor("WebRoot/WEB-INF/web.xml");
        context.setResourceBase("WebRoot");
        context.setContextPath("/hello");
        context.setParentLoaderPriority(true);

        server.setHandler(context);

        server.start();
        server.join();
    }

}


Previous     Next
ponxu /
Categories Java  Tags Java