Tomcat——Web 服务器还是 Web 容器?
我心里有一个小小的疑问;谁能澄清一下 Tomcat Web 服务器还是 Web 容器?
I've a small doubt in my mind; could anyone please clarify me is the Tomcat web server or Web container?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它既是一个Web 服务器(支持 HTTP 协议)和一个Web 容器(支持 JSP/Servlet API,有时也称为“servlet 容器”)。
It's both a web server (supports HTTP protocol) and a web container (supports JSP/Servlet API, also called "servlet container" at times).
如上所述,Tomcat 既是一个 Web 服务器,又是一个 Web 容器,但它并不是真正意义上的高性能 Web 服务器,也不包含 Web 服务器的一些典型功能。 Tomcat 旨在与 Apache Web 服务器结合使用,其中 Apache 管理静态页面、缓存、重定向等,而 Tomcat 处理容器(Web 应用程序)功能。您经常会同时听到“Apache Tomcat”这个短语,这既是 Tomcat 项目(作为 Apache 基金会的一部分)的正确归属,又适合作为标签,因为它们通常作为包一起使用。
如果您没有高性能服务器要求和/或想要嵌入一个具有容器功能的相对简单的 Web 服务器,那么 Tomcat 就适合(并且可能是最容易使用的嵌入式 Web 容器,与 Jetty 相当)。有趣的是,用作主 Tomcat 引擎的 Catalina 类实际上是可在独立 Web 应用程序中使用的 Embedded 类的子类。
As mentioned above, Tomcat is both a web server and a web container, but it's not really meant to function as a high performance web server, nor does it include some features typical of a web server. Tomcat is meant to be used in conjunction with the Apache web server, where Apache manages static pages, caching, redirection, etc. and Tomcat handles the container (web application) functions. You'll often hear the phrase "Apache Tomcat" together, which is both a proper attribution of the Tomcat project (as part of the Apache Foundation), but also appropriate as a label, as they're usually used together as a package.
If you don't have an high performance server requirements and/or want to embed a relatively simple web server with container functionality, Tomcat is fine for that (and probably the easiest embedded web container to work with, comparable with Jetty). Interestingly, the Catalina class used as the main Tomcat engine is actually a subclass of the Embedded class that can be used in a standalone web application.
Web 服务器是任何接受传入 HTTP 连接的程序。
A web server is any program that accepts incoming HTTP connections.