import java.text.SimpleDateFormat; import java.util.Date; import org.mortbay.http.SocketListener; import org.mortbay.jetty.Server; import com.dev.stms.server.service.vehicle.AppManager; import com.dev.stms.server.service.vehicle.pojo.DefaultAppManager; import com.dev.stms.server.utils.DateUtil; public class AjaxJettyLauncher { protected int port = 8088; protected String contextName = "hdtms"; protected String deployPath = ""; public static void main(String[] args) throws Exception { // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // Date d =new Date(); // String dd =format.format(d); // Date ddd; // ddd = format.parse(dd); // System.out.println("dd>>>> "+dd); // System.out.println("ddd>>> "+ddd); // System.out.println(DateUtil.getFirstHourOFDay()); AjaxJettyLauncher jl = new AjaxJettyLauncher(); jl.init(); 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 (deployPath.length() == 0) { deployPath = "./target/" + contextName + "/"; } return deployPath; } }