Since the Web program was written, how the Web program is running in Tomcat has been confusing me, do not know the underlying mechanism is unable to really understand the web, so began to study Tomcat source, Tomcat is a lightweight Java server, and then combined with the " How Tomcat works and the online Daniel Blog are also known for their internal operating architectures.
First go to the official website to download tomcat source code, I downloaded is apache-tomcat-7.0.63-src (download here), because the source code using Ant and Maven management, so to use Ant or maven compiled for the Eclipse project. The Ant method compiles with a lot of errors and problems, so this is where Maven compiles it.
First, you will download theapache-tomcat-7.0.50-src.tar.gz
Unzip totomcat
directory, and then in thetomcat
directory, create apom.xml
file with the following contents:
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org /2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4 _0_0.xsd "> <modelVersion>4.0.0</modelVersion> <groupId>net.imtiger</groupId> <artif Actid>tomcat-study</artifactid> <name>tomcat 7.0 study</name> <version>1.0</version& Gt <packaging>pom</packaging> <modules> <module>apache-tomcat-7.0.63-src</module> </modules></project>
and then in apache-tomcat-7.0.63-src directory to create a
pom.xml
file with the following contents:
<?xml version= "1.0" encoding= "UTF-8"? ><project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http: Www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0/http Maven.apache.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupId> Org.apache.tomcat</groupid> <artifactId>Tomcat7.0</artifactId> <name>tomcat7.0</name > <version>7.0</version> <build> <finalName>Tomcat7.0</finalName> < ;sourcedirectory>java</sourcedirectory> <testSourceDirectory>test</testSourceDirectory> <resources> <resource> <directory>java</directory> </reso urce> </resources> <testResources> <testResource> <directo Ry>test</directory> </TESTRESOURCe> </testResources> <plugins> <plugin> <groupid>org.apa Che.maven.plugins</groupid> <artifactId>maven-compiler-plugin</artifactId> <version>2.3</version> <configuration> <encoding>utf-8</enco Ding> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactid>junit</artifacti d> <version>4.4</version> <scope>test</scope> </dependency> <dependency> <groupId>ant</groupId> <artifactid>ant</artifactid> ; <version>1.7.0</version> </dependency> <dependency> <groupid>wsdl4j</groupi d> <artifactId>wsdl4j</artifactId> <version>1.6.2</version> </d ependency> <dependency> <groupId>javax.xml</groupId> <artifactid>j axrpc</artifactid> <version>1.1</version> </dependency> <dependency> ; <groupId>org.eclipse.jdt.core.compiler</groupId> <artifactId>ecj</artifactId> <version>4.2.2</version> </dependency> </dependencies></project>
Finally, in
tomcat
under directory execution
mvn eclipse:eclipse
create Eclipse Project and import it.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Tomcat source Parsing (a) Download the source code and import eclipse