Tomcat源码解读--代码走读之(四十二的2-3-2-5)registerHost(host)(四十四)

  其中MapperListener mapperListener = new MapperListener(mapper, this) Mapper mapper = new Mapper()this=connector,代码在connector中。



 

1、mapper.addHost(host.getName(), aliases, host)



 

1)、insertMap(hosts, newHosts, newHost),如下。



 

    1)、在oldMap中找新元素的name

    2)、进行数组赋值。

    3)、新数组中增加元素。

2、registerContext((Context) container),从host中找出有效的context进行注册context,代码如下。



 

1)、   mapper.addContextVersion(host.getName(), host, contextPath,context.getWebappVersion(), context, welcomeFiles, resources);代码在mapper中。

1)、HostmappedHost = hosts[pos],取出host

2)、mappedHost.contextList.contexts= newContexts,增加context

3)、ContextmappedContext = mappedHost.contextList.contexts[pos2]newContextVersion的属性设置,mappedContext.versions = newContextVersions

2)、registerWrapper((Wrapper) container),也就是servlet



 

    1)、mapper.addWrapper(hostName, contextPath, version,mapping, wrapper,jspWildCard,context.isResourceOnlyServlet(wrapperName))



 

      1))、进行校验,hostcontextversion.

      2))、addWrapper(contextVersion,path, wrapper, jspWildCard,

                            resourceOnly),代码如下。



 

            1)))、根据path(也就是mapping)进行分类,在context中增加。分为4WildcardwrapperExtensionwrapperDefaultwrapperExactwrapper

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值