Sha256: 9b997dc41b1f2e239115d1eb98fe7096011c932d376d3fa22c8c7a80936f8f3d
Contents?: true
Size: 1.68 KB
Versions: 3
Compression:
Stored size: 1.68 KB
Contents
package com.dievision.sinicum.runner; import org.apache.catalina.LifecycleException; import org.apache.catalina.connector.Connector; import org.apache.catalina.startup.Tomcat; import com.beust.jcommander.JCommander; public class Main { public static void main(String[] args) throws Exception { Configuration config = new Configuration(); new JCommander(config, args); Tomcat tomcat = new Tomcat(); tomcat.setPort(config.getHttpPort()); tomcat.getConnector().setURIEncoding("UTF-8"); if (config.getAjpPort() != null) { Connector connector = new Connector("AJP/1.3"); connector.setPort(config.getAjpPort()); connector.setURIEncoding("UTF-8"); tomcat.getService().addConnector(connector); } tomcat.setBaseDir(config.getBaseDir()); tomcat.getHost().setAppBase(config.getAppBase()); if (config.getHostname() != null) { tomcat.setHostname(config.getHostname()); tomcat.getHost().setName(config.getHostname()); } tomcat.addWebapp(config.getContextPath(), config.getAppBase()); addShutdownHook(tomcat); tomcat.start(); tomcat.getServer().await(); } private static void addShutdownHook(final Tomcat tomcat) { Runtime runtime = Runtime.getRuntime(); runtime.addShutdownHook(new Thread(new Runnable() { @Override public void run() { try { tomcat.getServer().stop(); } catch (LifecycleException e) { System.err.println("Error stopping Tomcat: " + e.toString()); } } })); } }
Version data entries
3 entries across 3 versions & 1 rubygems