/*
 * Copyright (c) 2001-2014,FineReport Inc, All Rights Reserved.
 */

package com.fr.start;


import org.mortbay.http.SocketListener;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.WebApplicationContext;
import org.mortbay.jetty.servlet.XMLConfiguration;

/**
 * Created with IntelliJ IDEA.
 * User: THX
 * Date: 13-8-22
 * Time: 上午9:42
 * To change this template use File | Settings | File Templates.
 */
public class JettyFRHost {
	public static void main(String[] args) throws Exception {


		Server server = new Server();
		SocketListener listener = new SocketListener();
		listener.setPort(8076);
		server.addListener(listener);
		server.setWebApplicationConfigurationClassNames(new String[]{XMLConfiguration.class.getName()});

		WebApplicationContext webapp = server.addWebApplication("/WebReport", "D:\\fineReport\\WebReport");
//		WebAppContext context = new WebAppContext();
//		context.setDescriptor("d:/fineReport/WebReport/" + "/WEB-INF/web.xml");
//		context.setResourceBase("d:/fineReport/WebReport/");
//		context.setContextPath("/WebReport");
//		context.setParentLoaderPriority(true);
//		server.setHandler(context);
		if (!webapp.isStarted()) {
			webapp.start();
		}
		server.start();
	}
}