Java Tomcat--Web 服务器还是 Web 容器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1893253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 23:36:50  来源:igfitidea点击:

Tomcat--Web Server or Web Container?

javatomcatwebservercontainers

提问by Pauo

I've a small doubt in my mind; could anyone please clarify me is the Tomcat web server or Web container?

我心中有一个小小的疑问;任何人都可以澄清我是Tomcat Web服务器还是Web容器?

采纳答案by BalusC

It's botha web server(supports HTTP protocol) and a web container(supports JSP/Servlet API, also called "servlet container" at times).

这是一个web服务器(支持HTTP协议)和Web容器(支持JSP / Servlet API中,也有时称为“servlet容器”)。

回答by Chad Okere

A web server is any program that accepts incoming HTTP connections.

Web 服务器是任何接受传入 HTTP 连接的程序。

回答by Ichiro Furusato

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.

如上所述,Tomcat 既是 Web 服务器又是 Web 容器,但它并不是真正意义上的高性能 Web 服务器,也不包含 Web 服务器的一些典型功能。Tomcat 旨在与 Apache Web 服务器结合使用,其中 Apache 管理静态页面、缓存、重定向等,而 Tomcat 处理容器(Web 应用程序)功能。您经常会听到“Apache Tomcat”这个词,这既是 Tomcat 项目(作为 Apache 基金会的一部分)的正确归属,也适合作为标签,因为它们通常作为一个包一起使用。

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 Catalinaclass used as the main Tomcat engine is actually a subclass of the Embeddedclass that can be used in a standalone web application.

如果您没有高性能服务器要求和/或想要嵌入具有容器功能的相对简单的 Web 服务器,Tomcat 非常适合(并且可能是最容易使用的嵌入式 Web 容器,与 Jetty 相当)。有趣的是,用作 Tomcat 主引擎的Catalina类实际上是Embedded类的子类,可以在独立的 Web 应用程序中使用。