Apache Tomcat introduction:
- Open-source framework: http://tomcat.apache.org /. An independent web application can be embedded or used as a server for multiple web applications.
- The Java-based Web Application Server container can host web applications of Servlet and Java Server Pages (JSP. After we deploy common J2EE frameworks, such as spring MVC and structs to Tomcat, Tomcat automatically parses them into Serlvet and JSP. When the frontend and backend development are completely isolated (only interfaces are provided in the backend and called at the front end), the original El expression is not recommended. No Java code is available at the front end. angularjs and ember can be used. JS as a front-end technology.
Tomcat versions and the corresponding servlet, JSP version and JDK (: http://www.oracle.com/technetwork/java/javase/downloads/index.html) is as follows (when installing Tomcat, JDK version should not be wrong ):
Apache Tomcat |
Servlet API |
JSP API |
JDK |
7.0 |
3.0 |
2.2 |
1.6 |
6.0 |
2.5 |
2.1 |
1.5 |
5.5 |
2.4 |
2.0 |
1.4 |
4.1 |
2.3 |
1.2 |
1.3 |
3.0 |
2.2 |
1.1 |
1.1 |
The Tomcat Manager Web Application
The Manager Web application is released along with Tomcat and embedded in Tomcat. Located under % catalina_home %/webapps/manager. After Tomcat is started, you can access it in the browser. To use the Manager Web application to manage Web applications, you need to add users and Set permissions to Manager-Gui. It can be used to manage all web applications running on Tomcat, such as installation, deletion, start, and stop.
Specialized realm implementations
A security mechanism provided by Tomcat can effectively protect web applications and resources deployed on Tomcat. Users can configure users and corresponding roles and permissions to implement basic security measures.
Tomcat Valves
Released along with Tomcat 4.x, it can only be applied to Tomcat. It can intercept HTTP requests from the client, process requests and response, and implement functions similar to servlet. However, because it is dedicated to Tomcat, It is designed with better performance and robustness than servlet. You can use it to configure filters for all web applications. Servlet configurations can only be applied to a single web application, with low reusability.
Tomcat Architecture
One JVM can run only one Tomcat container. Tomcat designers adopt this method. Once the JVM crashes, the security of applications deployed on Tomcat can be ensured. The following XML file and image describe each component and container in Tomcat. The XML file is located in % catalina_home %/CONF/server. xml.
1 <Server> 2 <Service> 3 <Connector /> 4 <Engine> 5 <Host> 6 <Context> </Context> 7 </Host> 8 </Engine> 9 </Service> 10 </Server>
View code
- Server: a root-level element in Tomcat. A tomcat container can have only one <Server> element. A <Server> element can contain multiple <service> elements.
- Service: Configure <Server> element. You can configure multiple elements. A <service> element can contain multiple <connector> elements. These <connector> elements share one <engine> element.
- Connector: the connector <service> element. You can configure multiple connectors. It can process requests and response requests from a single web application.
- Engine: A <service> element can have only one <engine> element. All requests can be processed. These requests must come from <connector>.
- Context: You can configure multiple. In tomcat, this is the most frequently used element. A <context> element represents a web application running on Tomcat, which must be included in
Tomcat installation (Windows, Linux)
We will not introduce it here. After downloading the tomcat installation package, you can find the solution in % catalina_home %/webapps/docs/index.html, including Windows and Linux.