1. server的實(shí)例類(lèi)為:org.apache.catalina.core.StandardServer為頂層容器。
2.二級(jí)容器GlobalNamingResources,設(shè)置認(rèn)證用戶(hù)信息。
? <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. 二級(jí)容器service,包括了多個(gè)connector和一個(gè)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. 三級(jí)容器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>
實(shí)現(xiàn)類(lèi)關(guān)系
Event-Listerner事件監(jiān)聽(tīng)模式
事件監(jiān)聽(tīng)同步模式分兩個(gè)部分:Event Source和Event Listener:
Event Source:被監(jiān)聽(tīng)者的事件集合,可能是方法,提供事件的注冊(cè)加入和移除功能。類(lèi)似被觀(guān)察者的集合。
Event Listener:事件的監(jiān)聽(tīng)者,當(dāng)事件被觸發(fā),所有監(jiān)聽(tīng)這個(gè)事件的監(jiān)聽(tīng)者將被通知,然后執(zhí)行自己的Action響應(yīng)動(dòng)作。
事件監(jiān)聽(tīng)異步模式在Source和Listener之間引入event queue,
event queue是一個(gè)基于事件的publish-subscribe. 它一種松耦合方式提供不同模塊和角色之間異步通訊。它比同步更加松耦合,這樣,我們就把Source-Listener改成了publish-queue-subscribe方式。
?
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

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