1. server的實例類為:org.apache.catalina.core.StandardServer為頂層容器。
2.二級容器GlobalNamingResources,設置認證用戶信息。
? <GlobalNamingResources>
??? <!-- Editable user database that can also be used by
???????? UserDatabaseRealm to authenticate users
??? -->
??? <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>
3. 二級容器service,包括了多個connector和一個engine
? <!-- A "Service" is a collection of one or more "Connectors" that share
?????? a single "Container" Note:? A "Service" is not itself a "Container",
?????? so you may not define subcomponents such as "Valves" at this level.
?????? Documentation at /docs/config/service.html
?? -->
? <Service name="Catalina">
??? <Connector port="8080" protocol="HTTP/1.1"
?????????????? connectionTimeout="20000"
?????????????? redirectPort="8443" />
??? <!-- Define an AJP 1.3 Connector on port 8009 -->
??? <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
??? <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
??? -->
??? <Engine name="Catalina" defaultHost="localhost">
3. 三級容器Engine包括Realm和Host。
??? <Engine name="Catalina" defaultHost="localhost">
?
????? <!--For clustering, please take a look at documentation at:
????????? /docs/cluster-howto.html? (simple how to)
????????? /docs/config/cluster.html (reference documentation) -->
????? <!--
????? <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
????? -->
?
?? ???<!-- Use the LockOutRealm to prevent attempts to guess user passwords
?????????? via a brute-force attack -->
????? <Realm className="org.apache.catalina.realm.LockOutRealm">
??????? <!-- This Realm uses the UserDatabase configured in the global JNDI
? ???????????resources under the key "UserDatabase".? Any edits
???????????? that are performed against this UserDatabase are immediately
???????????? available for use by the Realm.? -->
??????? <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
?????????????? resourceName="UserDatabase"/>
????? </Realm>
?
????? <Host name="localhost"? appBase="webapps"
??????????? unpackWARs="true" autoDeploy="true">
?
??????? <!-- SingleSignOn valve, share authentication between web applications
???????????? Documentation at: /docs/config/valve.html -->
??????? <!--
??????? <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
??????? -->
?
??????? <!-- Access log processes all example.
???????????? Documentation at: /docs/config/valve.html
???????????? Note: The pattern used is equivalent to using pattern="common" -->
??????? <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>
實現類關系
Event-Listerner事件監聽模式
事件監聽同步模式分兩個部分:Event Source和Event Listener:
Event Source:被監聽者的事件集合,可能是方法,提供事件的注冊加入和移除功能。類似被觀察者的集合。
Event Listener:事件的監聽者,當事件被觸發,所有監聽這個事件的監聽者將被通知,然后執行自己的Action響應動作。
事件監聽異步模式在Source和Listener之間引入event queue,
event queue是一個基于事件的publish-subscribe. 它一種松耦合方式提供不同模塊和角色之間異步通訊。它比同步更加松耦合,這樣,我們就把Source-Listener改成了publish-queue-subscribe方式。
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
