日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

tomcat server容器解读

發布時間:2025/4/5 编程问答 14 豆豆
生活随笔 收集整理的這篇文章主要介紹了 tomcat server容器解读 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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 &quot;%r&quot; %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方式。

?

轉載于:https://www.cnblogs.com/davidwang456/p/3251018.html

總結

以上是生活随笔為你收集整理的tomcat server容器解读的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。