`

Tomcat构架学习笔记

阅读更多

 

 

 

 

 

 

                                               HowTomcatWorks 第五章

 

The SimpleContext class represents a context. It uses the SimpleContextMapper as its mapper and SimpleContextValve as its basic valve. Two valves, ClientIPLoggerValve and HeaderLoggerValve, are added to the context. Two wrappers, each represented by SimpleWrapper, are added as child containers of the context. The wrappers use SimpleWrapperValve as their basic valve but do not have additional valves.


The Context application uses the same loader and the two valves. However, the loader and valves are associated with the context, not a wrapper. This way, the loader can be used by both wrappers. The context is assigned as the container for the connector. Therefore, the connector will call the invoke method of the context every time it receives an HTTP request. The rest is not hard to figure out if you recall our discussion above:


1. A container has a pipeline. The container's invoke method calls the pipeline's invoke method.


2. The pipeline's invoke method invokes all the valves added to its container and then calls its basic valve's invoke method.


3. In a wrapper, the basic valve is responsible to load the associated servlet class and respond to the request.


4. In a context with child containers, the basic valve uses a mapper to find a child container that is responsible for processing the request. If a child container is found, it calls the invoke method of the child container. It then goes back to Step 1.


Now let's see the order of processing in the implementation. The SimpleContext class's invoke method calls the pipeline's invoke method.

 

public void invoke(Request request, Response response) throws IOException, ServletException {

 pipeline.invoke(request, response);

}

 

The pipeline is represented by the SimplePipeline class. Its invoke method is as follows.

 

 public void invoke(Request request, Response response) throws IOException, ServletException { // Invoke the first Valve in this pipeline for this request

 

 (new SimplePipelineValveContext()).invokeNext(request, response);

 

 }

 

 

 

 

 

                                                             第六章

 

                                                           第8章 类装载器

 

Starting from J2SE 1.2, the JVM employs three class loaders: bootstrap class loader, extension class loader, and system class loader.

 

Each of the three class loaders has a parent-child relationship with each other, in which the bootstrap class loader sits at the top of the hierarchy and the system class loader at the bottom.


The bootstrap class loader is used to bootstrap the JVM. It starts working whenever you call the java.exe program. As such, it must be implemented using the native code because it is used to load the classes required for the JVM to function. Also, it is responsible for loading all the core Java classes, such as those in java.lang and java.io packages. The bootstrap class loader searches the core libraries such as rt.jar, i18n.jar, etc. Which libraries are searched depends on the version of the JVM and the operating system.

 

 

The extension class loader is responsible for loading classes in a standard extension directory. This is to make the programmer's life easier because they can just copy JAR files into this extension directory and the jar files will be searched automatically.

The extension library differs from one vendor to another. Sun's JVM's standard extension directory is /jdk/jre/lib/ext.

 


The system class loader is the default class loader and searches the directories and JAR files specified in the CLASSPATH environment variable.

 

 

                                            第9章 Session Manager

 

                                         第10章 Security

 

A realm is a component used for authenticating a user. It can tell you whether or not a pair of user name and password is valid.

 

A principal is represented by the java.security.Principal interface. Its implementation in Catalina is the org.apache.catalina.realm.GenericPrincipal class

 

 

                                      第11章 StandardWrapper

分享到:
评论

相关推荐

    tomcat7.0学习笔记

    【Tomcat7.0学习笔记】 Tomcat 7.0是Apache软件基金会的Jakarta项目下的一个开源Java Servlet容器,它实现了Java Servlet和JavaServer Pages(JSP)规范,为Web应用程序提供服务。本笔记主要涵盖了在Linux环境下...

    tomcat学习笔记

    【标题】:Tomcat学习笔记 【正文】: Tomcat是一款广泛应用的开源Web服务器和Java Servlet容器,由Apache软件基金会的Jakarta项目开发。它实现了Java Servlet和JavaServer Pages(JSP)规范,并且作为轻量级应用...

    tomcat学习精华笔记

    【Tomcat 学习精华笔记】 Tomcat 是一个广泛应用的开源服务器,主要用于托管Java Web应用程序。它虽然不是严格意义上的应用服务器,但作为一个Servlet容器,它能够处理Servlet和JSP,并且具备了一些应用服务器的...

    tomcat6学习笔记.txt

    ### Tomcat 6 学习笔记 #### 一、Tomcat 6 平台搭建与配置 ##### 1. 下载与安装 Tomcat 6 是一个免费且开源的Servlet容器,由Apache软件基金会下的Jakarta项目开发。可以通过官方网站:...

    tomcat6学习笔记【原创】

    ### Tomcat 6 学习笔记 #### 一、Tomcat 6 平台搭建与配置 ##### 1. 下载与安装 Tomcat 6 是一个免费且开源的Servlet容器,由Apache软件基金会下的Jakarta项目开发。可以通过官方网站进行下载:...

    Tomcat学习笔记

    《Tomcat学习笔记》 Tomcat是一款开源的Java Servlet容器,是Apache软件基金会下的Jakarta项目中的核心项目,主要用于运行Java Web应用程序。本笔记将详细阐述Tomcat的安装、配置、虚拟主机设置、JDBC数据库连接池...

    tomcat学习笔记.rar

    【标题】:Tomcat学习笔记 【描述】:Tomcat是一款广泛应用的开源Java Servlet容器,由Apache软件基金会下属的Tomcat项目开发维护。它主要用于部署和运行Java Web应用程序,包括Servlet和JSP。Tomcat以其轻量级、...

    tomcat&http笔记.pdf

    Browser/Server 浏览器/服务器 访问服务器资源不需要专门安装客户端软件,而是直接通过浏览器访问服务器资源. 例如: 天猫、京东、知乎网站 开发者通过web服务器可以把...进入Tomcat安装目录/conf/server.xml 文件修改

    如何使用tomcat--学习笔记

    【如何使用Tomcat——学习笔记】 Tomcat是一款广泛使用的开源Java Servlet容器,它实现了Java EE的Web部分,包括Servlet和JSP规范。本教程将详细解释如何配置和使用Tomcat,以便于开发和测试Servlet应用。 1. **...

    云的学习笔记-云的学习笔记系统-云的学习笔记系统源码-云的学习笔记管理系统-基于ssm的云的学习笔记系统-ssm-java代码

    云的学习笔记-云的学习笔记系统-云的学习笔记系统源码-云的学习笔记管理系统-云的学习笔记管理系统java代码-云的学习笔记系统设计与实现-基于ssm的云的学习笔记系统-基于Web的云的学习笔记系统设计与实现-云的学习...

    Tomcat&Servlet笔记.md

    Tomcat&Servlet学习笔记

    tomcat源码研读笔记中的tomcat源码

    《Tomcat源码研读笔记》是对Apache Tomcat服务器内部工作原理的深度探索。Tomcat作为一款广泛应用的开源Java Servlet容器,它的源码是理解Java Web应用运行机制的关键。本笔记将围绕Tomcat的核心组件、架构设计以及...

    java,myeclipes ,tomcat servlet jsp学习笔记

    【Java学习笔记】这篇学习笔记主要涵盖了Java开发中的一些基础操作和配置,特别是使用Eclipse作为IDE,结合Tomcat服务器进行Servlet和JSP开发时的关键点。以下是对这些知识点的详细说明: 1. **Eclipse快捷键配置**...

    Tomcat学习笔记,图片比较多,懒得写博客,先上传

    Tomcat学习笔记,图片比较多,懒得写博客,先上传

    完整图解 Tomcat 5.0.28 安装笔记

    ### Tomcat 5.0.28 安装与配置详解 #### 一、准备工作:J2SDK与TOMCAT的准备 在正式开始安装Tomcat 5.0.28之前,首先需要确保系统中已安装Java 2 Standard Edition(J2SDK),因为Tomcat服务器是基于Java平台构建...

    tomcat实战笔记

    Tomcat实战笔记详细介绍了Apache Tomcat服务器,这是一个由Apache软件基金会管理的Jakarta项目核心产品。Tomcat作为一个开源Web应用服务器,常用于中小型系统中,特别是在并发访问用户数量不是很多的情况下,它是一...

Global site tag (gtag.js) - Google Analytics