學習JSP有一段時間了,對
Tomcat
Server環境配置也有了一些心得,陸續會把
Tomcat
Server的幾篇文章拿出來跟大家分享一下,本篇先先說一下
Tomcat
Server的組成部分
1.1 - Server
A Server element represents the entire Catalina servlet container. (Singleton)
1.2 - Service
A Service element represents the combination of one or more Connector components that share a single Engine
Service是這樣一個集合:它由一個或者多個Connector組成,以及一個Engine,負責處理所有Connector所獲得的客戶請求
1.3 - Connector
一個Connector將在某個指定端口上偵聽客戶請求,并將獲得的請求交給Engine來處理,從Engine處獲得回應并返回客戶
TOMCAT有兩個典型的Connector,一個直接偵聽來自browser的http請求,一個偵聽來自其它WebServer的請求
Coyote Http/1.1 Connector 在端口8080處偵聽來自客戶browser的http請求
Coyote JK2 Connector 在端口8009處偵聽來自其它WebServer(Apache)的servlet/ jsp 代理請求
1.4 - Engine
The Engine element represents the entire request processing machinery associated with a particular Service
It receives and processes all requests from one or more Connectors
and returns the completed response to the Connector for ultimate transmission back to the client
Engine下可以配置多個虛擬主機Virtual Host,每個虛擬主機都有一個域名
當Engine獲得一個請求時,它把該請求匹配到某個Host上,然后把該請求交給該Host來處理
Engine有一個默認虛擬主機,當請求無法匹配到任何一個Host上的時候,將交給該默認Host來處理
1.5 - Host
代表一個Virtual Host,虛擬主機,每個虛擬主機和某個 網絡 域名Domain Name相匹配
每個虛擬主機下都可以部署(deploy)一個或者多個Web App,每個Web App對應于一個Context,有一個Context path
當Host獲得一個請求時,將把該請求匹配到某個Context上,然后把該請求交給該Context來處理
匹配的方法是“最長匹配”,所以一個path==""的Context將成為該Host的默認Context
所有無法和其它Context的路徑名匹配的請求都將最終和該默認Context匹配
1.6 - Context
一個Context對應于一個Web Application,一個Web Application由一個或者多個Servlet組成
Context在創建的時候將根據配置文件$CATALINA_HOME/conf/web.xml和$ WEB APP_HOME/ WEB -INF/web.xml載入Servlet類
當Context獲得請求時,將在自己的映射表(mapping table)中尋找相匹配的Servlet類
如果找到,則執行該類,獲得請求的回應,并返回?
1.1 - Server
A Server element represents the entire Catalina servlet container. (Singleton)
1.2 - Service
A Service element represents the combination of one or more Connector components that share a single Engine
Service是這樣一個集合:它由一個或者多個Connector組成,以及一個Engine,負責處理所有Connector所獲得的客戶請求
1.3 - Connector
一個Connector將在某個指定端口上偵聽客戶請求,并將獲得的請求交給Engine來處理,從Engine處獲得回應并返回客戶
TOMCAT有兩個典型的Connector,一個直接偵聽來自browser的http請求,一個偵聽來自其它WebServer的請求
Coyote Http/1.1 Connector 在端口8080處偵聽來自客戶browser的http請求
Coyote JK2 Connector 在端口8009處偵聽來自其它WebServer(Apache)的servlet/ jsp 代理請求
1.4 - Engine
The Engine element represents the entire request processing machinery associated with a particular Service
It receives and processes all requests from one or more Connectors
and returns the completed response to the Connector for ultimate transmission back to the client
Engine下可以配置多個虛擬主機Virtual Host,每個虛擬主機都有一個域名
當Engine獲得一個請求時,它把該請求匹配到某個Host上,然后把該請求交給該Host來處理
Engine有一個默認虛擬主機,當請求無法匹配到任何一個Host上的時候,將交給該默認Host來處理
1.5 - Host
代表一個Virtual Host,虛擬主機,每個虛擬主機和某個 網絡 域名Domain Name相匹配
每個虛擬主機下都可以部署(deploy)一個或者多個Web App,每個Web App對應于一個Context,有一個Context path
當Host獲得一個請求時,將把該請求匹配到某個Context上,然后把該請求交給該Context來處理
匹配的方法是“最長匹配”,所以一個path==""的Context將成為該Host的默認Context
所有無法和其它Context的路徑名匹配的請求都將最終和該默認Context匹配
1.6 - Context
一個Context對應于一個Web Application,一個Web Application由一個或者多個Servlet組成
Context在創建的時候將根據配置文件$CATALINA_HOME/conf/web.xml和$ WEB APP_HOME/ WEB -INF/web.xml載入Servlet類
當Context獲得請求時,將在自己的映射表(mapping table)中尋找相匹配的Servlet類
如果找到,則執行該類,獲得請求的回應,并返回?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

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