初识tomcat

  • tomcat目录结构

    bin/ : 二进制可执行文件和脚本,比如tomcat的启动命令(Catalina,start等等)
    lib/ : 存放tomcat运行需要使用到的库,比如:servlet.jar、jsp.jar 等等
    conf/ :tomcat的配置文件,比如:server.xml 中就记录了tomcat占用的端口等情况
    logs/ :日志文件
    temp/ :临时文件
    webapps/ : 存放网站实例,比如我们刚配置好tomcat输入http://localhost:8080时访问 的web页面

  • conf/

    1. conf/server.xml

    服务器的主配置文件,tomcat在启动的时候会主动的读取server.xml 文件 里的内容,server.xml各个标签的的含义:

    • Server
      In the Tomcat world, a Server represents the whole container. Tomcat provides a default implementation of the Server interface., and this is rarely customized by users. (在整个tomcat里,一个server代表整个容器.Tomcat提供了一个默认的服务器接口的实现.用户很少修改这个默认的实现)

    • Service
      A Service is an intermediate component which lives inside a Server and ties one or more Connectors to exactly one Engine. The Service element is rarely customized by users, as the default implementation is simple and sufficient: Service interface. A "Service" is a collection of one or more "Connectors" that share a single "Container"(一个Service是一个中间件,存在在一个Server的内部,将一个或者多个Connectors绑定到一个特定的Engine上.因为Service默认的实现已经足够用了.所以很少有用户改动它。一个Service 是一个或者更多的Connector的集合,这些Connector共享一个容器)

    • Engine
      An Engine represents request processing pipeline for a specific Service. As a Service may have multiple Connectors, the Engine received and processes all requests from these connectors, handing the response back to the appropriate connector for transmission to the client.(一个Engine代表一个特定的Service的请求处理的管道.因为一个Service可以有多个Connectors,Engine接收并且处理从这些Connectors过来的所有的请求.并且将结果送回合适的Connector并发送给客户端.)

    • Host
      A Host is an association of a network name, e.g. www.yourcompany.com, to the Tomcat server. An Engine may contain multiple hosts, and the Host element also supports network aliases such as yourcompany.com and abc.yourcompany.com. Users rarely create custom Hosts because the StandardHost implementation provides significant additional functionality. (一个Host将一个域名和tomcat联系起来.一个Engine可以包含多个hosts,并且一个Host还支持网络别名(例如yourcompany.com 或者 abc.yourcompany.com).用户很少去实现一个Host接口,因为StandardHost这个默认的实现已经提供了丰富的扩展功能了)

    • Connector
      A Connector handles communications with the client. There are multiple connectors available with Tomcat, all of which implement the Connector interface. (一个Connector处理和客户端的通信.tomcat有多个connectors.这些个 Connectors都实现了Connector接口)

    • Context
      A Context represents a web application. A Host may contain multiple contexts, each with a unique path. (一个Context代表一个web应用程序。一个Host可以包含多个contexts。每一个有不同的访问地址。)在tomcat 5.5之前Context体现在/conf/server.xml中的Host里的元素,它由Context接口定义。每个 总结

      +++(ties one or more Connectors to exactly one Engine)
      ++++++(multiple, handles communications with the client)
      ++++++(receive and processes all requests from these connectors)
      +++++++++(association of a network name to the tomcat server)

      2. conf/web.xml

      定义所有的web配置,在每个web项目里也有自己对应的web.xml配置文件,后者的优先级高于前者

你可能感兴趣的:(初识tomcat)