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..
Also when we say Weblogic, is it a web server only ?
A web server is something that handles HTTP requests and responses.
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.
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
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
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.
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.
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.
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.
And adding to previous answers, Weblogic is app server and not only web server.
Basically if we say the major difference between Web Server & Application Server, is the protocols on which these servers work.
Web Server -- it works on protocols like HTTP & HTTPS. Example of this server is Apache. For web server you use JSP, Servlet.
Application Server -- it works on any protocol. example is JBOSS. On application server we host EJB, web service or any business Logic.
精彩评论