Context

A Context is a Container that represents a servlet context, and therefore an individual web application, in the Catalina servlet engine. It is therefore useful in almost every deployment of Catalina (even if a Connector attached to a web server (such as Apache) uses the web server's facilities to identify the appropriate Wrapper to handle this request. It also provides a convenient mechanism to use Interceptors that see every request processed by this particular web application.

The parent Container attached to a Context is generally a Host, but may be some other implementation, or may be omitted if it is not necessary.

The child containers attached to a Context are generally implementations of Wrapper (representing individual servlet definitions).

一个Context对应于一个Web Application,一个Web Application由一个或者多个Servlet组成

Context在创建的时候将根据配置文件$CATALINA_HOME/conf/web.xml和$WEBAPP_HOME/WEB-INF/web.xml载入Servlet类

当Context获得请求时,将在自己的映射表(mapping table)中寻找相匹配的Servlet类如果找到,则执行该类,获得请求的回应,并返回

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Context是Spring框架中的一个核心模块,它提供了一种高级的IoC容器,用于管理和组织应用程序中的对象。Spring Context负责创建、配置和管理应用程序中的Bean对象,并提供了一些高级功能,如依赖注入、AOP(面向切面编程)等。 Spring Context的主要功能包括: 1. IoC容器:Spring Context使用IoC(Inversion of Control)容器来管理对象的生命周期和依赖关系。通过配置文件或注解,可以将对象的创建、初始化和销毁等过程交给Spring容器来管理,从而降低了对象之间的耦合度。 2. 依赖注入:Spring Context支持依赖注入(Dependency Injection),即通过配置文件或注解将对象之间的依赖关系交给Spring容器来处理。这样可以实现松耦合的设计,方便进行单元测试和模块替换。 3. AOP支持:Spring Context提供了对AOP的支持,可以通过配置文件或注解来定义切面(Aspect)和通知(Advice),从而实现横切关注点的模块化和复用。 4. 事件机制:Spring Context提供了事件机制,可以在应用程序中发布和监听事件。通过事件机制,不同的组件可以进行解耦,实现松散耦合的设计。 5. 国际化支持:Spring Context提供了国际化(Internationalization)支持,可以方便地实现应用程序的多语言支持。 6. 配置管理:Spring Context支持多种配置方式,包括XML配置、注解配置和Java配置等。通过配置文件或注解,可以灵活地管理应用程序的配置信息。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值