我需要在嵌入式tomcat Realm's fine-grained notifications中配置AJP连接器 等于以下配置:
$(function() {
$(".menu").hover(
function() { $(".sub").slideToggle(400); },
function() { $(".sub").hide(); }
);
});
怎么做?
答案 0 :(得分:3)
// initialize tomcat with default nio connector
Tomcat tomcat = new Tomcat();
tomcat.setPort(8080);
tomcat.getHost().setAppBase(".");
tomcat.addWebapp("/", ".");
// create an AJP connector
Connector ajpConnector = new Connector("AJP/1.3");
ajpConnector.setPort(8009);
ajpConnector.setRedirectPort(8080);
ajpConnector.setSecure(false);
// add connector to tomcat
tomcat.getService().addConnector(ajpConnector);
tomcat.start();
tomcat.getServer().await();
从启动日志:
Dec 26, 2016 10:45:26 AM org.apache.catalina.core.StandardContext setPath
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
Dec 26, 2016 10:45:27 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Dec 26, 2016 10:45:27 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Dec 26, 2016 10:45:27 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Dec 26, 2016 10:45:27 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Dec 26, 2016 10:45:27 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Dec 26, 2016 10:45:27 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.28
Dec 26, 2016 10:45:27 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Dec 26, 2016 10:45:28 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Dec 26, 2016 10:45:28 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Dec 26, 2016 10:45:28 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
http-nio
正在侦听端口8080,并在端口8009上侦听ajp-nio
。