读书人

用Jetty Web Server运作你的应用程序

发布时间: 2012-06-27 14:20:08 作者: rapoo

用Jetty Web Server运行你的应用程序

?

A.http://www.codeproject.com/KB/java/Embedding_Jetty.aspx

?

B.public static void main(String[] args) {Server server = new Server();SocketConnector connector = new SocketConnector();connector.setMaxIdleTime(1000 * 60 * 60);connector.setSoLingerTime(-1);connector.setPort(8888);server.setConnectors(new Connector[] { connector });WebAppContext appContext = new WebAppContext();appContext.setParentLoaderPriority(true);appContext.setServer(server);appContext.setContextPath("/app");appContext.setWar("src/main/webapp");server.addHandler(appContext);try {server.start();} catch (Throwable e) {throw new RuntimeException(e);}}

读书人网 >Web前端

热点推荐