42 lines
		
	
	
		
			959 B
		
	
	
	
		
			Java
		
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			959 B
		
	
	
	
		
			Java
		
	
	
import com.dev.energy.client.utils.StringUtils;
 | 
						|
import org.mortbay.http.SocketListener;
 | 
						|
import org.mortbay.jetty.Server;
 | 
						|
 | 
						|
public class AjaxJettyLauncher {
 | 
						|
	protected int port = 8088;
 | 
						|
	protected String contextName = "thtms";
 | 
						|
	protected String deployPath = null;
 | 
						|
 | 
						|
	public static void main(String[] args) throws Exception {
 | 
						|
		AjaxJettyLauncher jl = new AjaxJettyLauncher();
 | 
						|
		jl.run();
 | 
						|
	}
 | 
						|
 | 
						|
	protected void init() {
 | 
						|
	}
 | 
						|
 | 
						|
	protected void run() throws Exception {
 | 
						|
		Server server = new Server();
 | 
						|
		SocketListener listener = new SocketListener();
 | 
						|
		listener.setPort(getPort());
 | 
						|
		server.addListener(listener);
 | 
						|
		server.addWebApplication("/" + getContextName() , getDeployPath());
 | 
						|
		server.start();
 | 
						|
	}
 | 
						|
 | 
						|
	protected int getPort() {
 | 
						|
		return port;
 | 
						|
	}
 | 
						|
 | 
						|
	protected String getContextName() {
 | 
						|
		return contextName;
 | 
						|
	}
 | 
						|
 | 
						|
	protected String getDeployPath() {
 | 
						|
		if (StringUtils.isEmpty(deployPath)) {
 | 
						|
			deployPath = "./target/" + contextName + "/";
 | 
						|
		}
 | 
						|
		return deployPath;
 | 
						|
	}
 | 
						|
}
 |