当前位置: 代码迷 >> Eclipse >> Jetty嵌入eclipse以后启动代码
  详细解决方案

Jetty嵌入eclipse以后启动代码

热度:91   发布时间:2016-04-23 00:18:48.0
Jetty嵌入eclipse之后启动代码
package com.tools;import org.eclipse.jetty.server.Server;import org.eclipse.jetty.webapp.WebAppContext;public class JettyServer {	/**	 * @param args	 * @throws Exception 	 */	public static void main(String[] args) throws Exception {		Server server = buildNormalServer(8080, "/");		server.start();	}		public static Server buildNormalServer(int port, String contextPath) {		Server server = new Server(port);		WebAppContext webContext = new WebAppContext(				"src/main/webapp", contextPath);		webContext.setClassLoader(Thread.currentThread()				.getContextClassLoader());		server.setHandler(webContext);		server.setAttribute("org.eclipse.jetty.Request.maxFormContentSize", 10000000);		server.setStopAtShutdown(true);		return server;	}}
  相关解决方案