当前位置: 代码迷 >> Web前端 >> 用Jetty Web Server运作你的应用程序
  详细解决方案

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

热度:525   发布时间:2012-06-27 14:20:08.0
用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);
		}
	}
  相关解决方案