读懂tomact源码4:Host
来源:互联网 发布:java产生10个随机数 编辑:程序博客网 时间:2024/06/06 05:44
Host
一个host在tomact中代表一个虚拟host,一般在下列情况下有用的:
- 你希望用拦截器来查看铁定的虚拟host的所有请求;
- 需要在tomact中用一个connector,但是需要多个虚拟host
StandardHost
Properties
- private String[] aliases = new String[0];
private final Object aliasesLock = new Object();
当前host的别名 - private String appBase = “webapps”;
当前host的应用程序根
private String xmlBase = null;
当前程序的xml的根 - private boolean autoDeploy = true;
host自动部署的标志 - Context相关
private String configClass = “org.apache.catalina.startup.ContextConfig”;
The Java class name of the default context configuration class for deployed web applications.
private String contextClass = “org.apache.catalina.core.StandardContext”;
The Java class name of the default Context implementation class for deployed web applications. - private boolean deployOnStartup = true;
当前host启动的标志 - private boolean deployXML = !Globals.IS_SECURITY_ENABLED;
deploy Context XML config files property. - private boolean copyXML = false;
Should XML files be copied to $CATALINA_BASE/conf/<engine>/<host> by default when a web application is deployed?
一般的情况
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"/>
- private String errorReportValveClass = “org.apache.catalina.valves.ErrorReportValve”;
The Java class name of the default error reporter implementation class
for deployed web applications. - private static final String info = “org.apache.catalina.core.StandardHost/1.0”;
The descriptive information string for this implementation. - private boolean unpackWARs = true;
Unpack WARs property. - private String workDir = null;
Work Directory base for applications. - private boolean createDirs = true;
Should we create directories upon startup for appBase and xmlBase - childClassLoaders
private Map<ClassLoader, String> childClassLoaders = new WeakHashMap<ClassLoader, String>();
Track the class loaders for the child web applications so memory leaks can be detected.
14. private Pattern deployIgnore = null;
Any file or directory in appBase that this pattern matches will be ignored by the automatic deployment process (both deployOnStartup autoDeploy).
15. private boolean undeployOldVersions = false;
16. private boolean failCtxIfServletStartFails = false;
Set Properties
在属性的设置方法里,可以看到同一个方法firePropertyChange,我们来看下这个方法.Reports a boolean bound property update to listeners that have been registered to track updates of all properties or a property with the specified name. No event is fired if old and new values are equal. This is merely a convenience wrapper around the more general
HostConfig
Startup event listener for a Host< that configures the properties of that Host, and the associated defined contexts.
/** * Deploy applications for any directories or WAR files that are found * in our "application root" directory. */ protected void deployApps() { File appBase = appBase(); File configBase = configBase(); String[] filteredAppPaths = filterAppPaths(appBase.list()); // Deploy XML descriptors from configBase deployDescriptors(configBase, configBase.list()); // Deploy WARs deployWARs(appBase, filteredAppPaths); // Deploy expanded folders deployDirectories(appBase, filteredAppPaths); }
理一下过程:
- Return a File object representing the “application root” directory for our associated Host.
- Return a File object representing the “configuration root” directory for our associated Host.
- Filter the list of application file paths to remove those that match the regular expression defined by Host.getDeployIgnore()
- Deploy XML context descriptors
- Deploy WAR files
- Deploy directories
HostConfig的内容,以后会详细的学习下.
阅读全文
0 0
- 读懂tomact源码4:Host
- 读懂tomact源码4:Container
- 读懂tomact源码4:Engine
- 读懂tomact源码二:Connector
- 读懂tomact源码三:Service
- 读懂tomact源码一:tomact7.0源码导入Intellij idea
- eclipse学习tomact源码
- tomact
- tomact
- tomact
- 一张图读懂sparkstreaming源码
- 如何读懂源码成为高手
- 读懂源码系列-FileZilla Server 设计原则分析-socket 事件处理流程(4)
- 转-如何读懂源码(下)
- 其实你可以读懂OKHttp3的源码
- 一步步带你读懂 CoordinatorLayout 源码
- 读懂Dubbo源码必备知识点之一
- 读懂Dubbo源码必备知识点之二
- 腾讯高级音视频架构师郭亮:解密互动直播技术
- linux线程系列(6)线程与进程的比较
- 说一说solr命令行(cmd)
- 第1章 基础知识
- Android build(1) -- makefile Android Building System 分析
- 读懂tomact源码4:Host
- Java网络编程——第十章 安全Sokcet
- RT3070 STA模式——开发板实现上网功能
- Android Spanned实现TextView富文本效果(2)--表情
- bzoj 4176 Lucas的数论
- ubuntu apt删除软件
- Android build(3) -- 学习makefile 其中的函数
- grep正则表达式
- Recycleview的实例及于listview的强弱分析