java Web服务器和应用服务器的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6733760/
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
Difference between web server and application server
提问by testndtv
As a layman, how do I understand the difference between web server and application server ? If you could give an example using a Java based web app in very "simple" terms that would be really great..
作为一个外行,我如何理解 web server 和 application server 之间的区别?如果您能以非常“简单”的术语举例使用基于 Java 的 Web 应用程序,那就太好了。
Also when we say Weblogic, is it a web server only ?
此外,当我们说 Weblogic 时,它只是一个 Web 服务器吗?
采纳答案by Bozho
A web server is something that handles HTTP requests and responses.
Web 服务器是处理 HTTP 请求和响应的东西。
An application server (like WebLogic, WebSphere, JBoss AS, Glassfish, etc) usually includes a web server, but also adds a lot more features. The most important is that it manages objects. Whether they will be servlets (Servlet container), EJBs (ejb container), JMS listeners, etc.
应用服务器(如 WebLogic、WebSphere、JBoss AS、Glassfish 等)通常包括一个 Web 服务器,但也添加了更多功能。最重要的是它管理对象。它们是否将是 servlet(Servlet 容器)、EJB(ejb 容器)、JMS 侦听器等。
回答by Maciej
Webserver can execute only web applications i,e servlets and JSPs and has only a single container known as Web container which is used to interpret/execute web applications
Web 服务器只能执行 Web 应用程序,即 servlet 和 JSP,并且只有一个称为 Web 容器的容器,用于解释/执行 Web 应用程序
Application server can execute Enterprise application, i,e (servlets, jsps, and EJBs) it is having two containers 1. Web Container(for interpreting/executing servlets and jsps) 2. EJB container(for executing EJBs). it can perform operations like load balancing , transaction demarcation etc etc
应用服务器可以执行企业应用程序,即(servlet、jsps 和 EJB)它有两个容器 1. Web 容器(用于解释/执行 servlet 和 jsps) 2. EJB 容器(用于执行 EJB)。它可以执行负载平衡、事务划分等操作
回答by pap
I would say definitions vary. In the generalized context, a Web Server is a server that can receive incoming web-requests and have knowledge about how they should be handled and responded to. Some requests are static (html files, images etc), some are dynamic. In the case of dynamic requests, the web server will know where to route handling of the request, could be a JSP page or a java servlet, a PHP script, a perl CGI script etc etc.
我会说定义各不相同。在广义上下文中,Web 服务器是可以接收传入的 Web 请求并了解应如何处理和响应这些请求的服务器。有些请求是静态的(html 文件、图像等),有些是动态的。在动态请求的情况下,Web 服务器将知道在哪里路由请求处理,可以是 JSP 页面或 Java servlet、PHP 脚本、perl CGI 脚本等。
While the "web server" in this context executes the dynamic handler, it is not considered to include any supporting middleware features for the dynamic handler.
虽然此上下文中的“Web 服务器”执行动态处理程序,但并不认为它包含任何支持动态处理程序的中间件功能。
An Application Server, by contrast, is a general execution environment that offers some type of middleware tier support. Examples are EJB containers or the .NET framework built into Windows (in where Windows in itself is an "application server"). There is no inherent requirement that an application-server have anything to do with web requests (although many do), it's just a general execution context and container for any type of application that offers some sort of additional middleware support.
相比之下,应用服务器是提供某种类型的中间件层支持的通用执行环境。示例是 EJB 容器或内置于 Windows 的 .NET 框架(其中 Windows 本身就是一个“应用程序服务器”)。应用程序服务器没有任何与 Web 请求有关的内在要求(尽管很多都这样做),它只是提供某种额外中间件支持的任何类型应用程序的通用执行上下文和容器。
In a purely web-centric context, many people will draw the line at static vs dynamic content. In this definition, a "web server" can only handle requests for static information itself and it will pass on requests for dynamic content to the "application server". For example, Apache httpd is a web server and Tomcat is an application server. IIS is a combination of both. In the Java web world, an application server can be either a servlet container (like Tomcat), or a full blown Java EE container (like JBoss, WebLogic or WebSphere) that provides the Java EE middleware support (EJB) container in addition to the servlet container.
在纯粹以网络为中心的环境中,许多人会在静态和动态内容之间划清界限。在这个定义中,“Web 服务器”只能处理对静态信息的请求,它会将动态内容的请求传递给“应用程序服务器”。例如,Apache httpd 是一个 Web 服务器,而 Tomcat 是一个应用程序服务器。IIS 是两者的结合。在 Java Web 世界中,应用服务器可以是一个 servlet 容器(如 Tomcat),也可以是一个完整的 Java EE 容器(如 JBoss、WebLogic 或 WebSphere),除了提供 Java EE 中间件支持 (EJB) 容器之外, servlet 容器。
回答by user1929527
Basically if we say the major difference between Web Server & Application Server, is the protocols on which these servers work.
基本上,如果我们说 Web 服务器和应用程序服务器之间的主要区别,就是这些服务器工作的协议。
Web Server-- it works on protocols like HTTP & HTTPS. Example of this server is Apache. For web server you use JSP, Servlet.
Web 服务器——它适用于 HTTP 和 HTTPS 等协议。此服务器的示例是 Apache。对于 Web 服务器,您使用 JSP、Servlet。
Application Server-- it works on any protocol. example is JBOSS. On application server we host EJB, web service or any business Logic.
应用服务器——它适用于任何协议。例子是JBOSS。在应用服务器上,我们托管 EJB、Web 服务或任何业务逻辑。
回答by Sergey Aslanov
And adding to previous answers, Weblogic is app server and not only web server.
添加到之前的答案中,Weblogic 是应用程序服务器,而不仅仅是 Web 服务器。