來源官方文檔 html
1. The Context element represents a web application web
context 表明着一個應用
apache
2. 能夠並行部署 tomcat
You may deploy multiple versions of a web application with the same context path at the same time
session
3. 定義一個context app
It is NOT recommended to place <Context> elements directly in the server.xml file. This is because it makes modifying theContext configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat. ide
不推薦直接在server.xml中定義context, (就是<host>內部那個) this
context 文件位置 spa
- /META-INF/context.xml inside the application files
- $CATALINA_BASE/conf/[enginename]/[hostname]/ 目錄下 已.xml 結尾文件 如默認的 /catalina/localhost
- 就是在server.xml 中的 engine/host/context
4. $CATALINA_BASE/conf/context.xml 文件是全局共享的, 能夠定義一些全局資源 rest
5. cotext 屬性
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Common_Attributes
6. context 內嵌元素
- Loader - Configure the web application class loader that will be used to load servlet and bean classes for this web application. Normally, the default configuration of the class loader will be sufficient.
- Manager - Configure the session manager that will be used to create, destroy, and persist HTTP sessions for this web application. Normally, the default configuration of the session manager will be sufficient.
- Realm - Configure a realm that will allow its database of users, and their associated roles, to be utilized solely for this particular web application. If not specified, this web application will utilize the Realm associated with the owning Host or Engine.
- Resources - Configure the resource manager that will be used to access the static resources associated with this web application. Normally, the default configuration of the resource manager will be sufficient.
- WatchedResource - The auto deployer will monitor the specified static resource of the web application for updates, and will reload the web application if it is updated. The content of this element must be a string
-------------------------------------------------------------------------------------------------
關於TOMCAT 的內部概念定義 context 也是其中一種 詳細查看文檔 若是你想看tomcat源碼的話也推薦有限瞭解這些概念
http://tomcat.apache.org/tomcat-7.0-doc/config/