我想運行僅使用HTTPS(8443)的嵌入式tomcat。我根本不需要8080端口。 有什麼想法?將Tomcat-7嵌入到僅在https中運行
Connector httpsConnector = new Connector(); httpsConnector.setPort(httpsPort); httpsConnector.setSecure(true); httpsConnector.setScheme("https"); httpsConnector.setAttribute("keystoreFile", appBase + "/.keystore"); httpsConnector.setAttribute("clientAuth", "false"); httpsConnector.setAttribute("sslProtocol", "TLS"); httpsConnector.setAttribute("SSLEnabled", true); Tomcat tomcat = new Tomcat(); tomcat.getService().addConnector(httpsConnector); tomcat.setPort(8080); Connector defaultConnector = tomcat.getConnector(); defaultConnector.setRedirectPort(8443); tomcat.setBaseDir("."); tomcat.getHost().setAppBase(appBase); StandardServer server = (StandardServer) tomcat.getServer(); AprLifecycleListener listener = new AprLifecycleListener(); server.addLifecycleListener(listener);
由於
你設法禁止8080端口嗎? – 2013-07-24 22:37:56