首页 > 网站 > Tomcat > 正文

tomcat7的配置文件server.xml解析

2024-09-06 19:00:52
字体:
来源:转载
供稿:网友

这里对tomcat7的server.xml文件进行解释一下,方便在分析启动源码的时候理解Digester做的事情。

<?xml version='1.0' encoding='utf-8'?><Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <Listener className="org.apache.catalina.security.SecurityListener" /> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <Listener className="org.apache.catalina.core.JasperListener" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources>  <Resource name="UserDatabase" auth="Container"       type="org.apache.catalina.UserDatabase"       description="User database that can be updated and saved"       factory="org.apache.catalina.users.MemoryUserDatabaseFactory"       pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina">  <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"    maxThreads="150" minSpareThreads="4"/>  <Connector port="8080" protocol="HTTP/1.1"        connectionTimeout="20000"        redirectPort="8443" />  <Connector executor="tomcatThreadPool"        port="8080" protocol="HTTP/1.1"        connectionTimeout="20000"        redirectPort="8443" />  <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"        maxThreads="150" SSLEnabled="true" scheme="https" secure="true"        clientAuth="false" sslProtocol="TLS" />  <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />  <Engine name="Catalina" defaultHost="localhost">   <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>   <Realm className="org.apache.catalina.realm.LockOutRealm">    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"        resourceName="UserDatabase"/>   </Realm>   <Host name="localhost" appBase="webapps"      unpackWARs="true" autoDeploy="true">    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"        prefix="localhost_access_log." suffix=".txt"        pattern="%h %l %u %t "%r" %s %b" />   </Host>  </Engine> </Service></Server>

Server

tomcat中Server代表一个tomcat实例,所以只会存在一个Server,而在配置文件中也是作为顶级元素出现,代码如下:

<Server port="8005" shutdown="SHUTDOWN">。。。</Server>
port,监听shutdown命令的端口,-1表示禁用shutdown命令。 shutdown,关闭tomcat的指令。

Listener

监听器,用来监听某些事件的发生。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表