1, Web server,web container and application Server differences.
Web Server,web server, as mentioned above, a Web server is a program that provides documentation for the requesting browser. A server is a passive program that responds only when the browser makes a request. The application layer is using the HTTP protocol. Currently the most mainstream three Web servers are Apache Nginx IIS.
A Web container is a server program that has a program that provides the appropriate service on the server port. So now you know why Tomcat has the default port--8080. A server can have multiple containers.
As with Tomcat, the servlet is parsed after receiving a request from the browser, and then the results of the servlet processing are returned to the browser. In fact, Tomcat is both a Web server and a Web container. Why do you say so, 3rd?
and the application server, here's a separate answer to the Web server:
What is the difference between application server and Web server?
Web server design serves HTTP content, and application servers are not limited to HTTP. Web servers serve static content, and plug-ins support dynamic languages,
The application server also has these things for the Web server, in addition to this it also supports program-level services such as connection pooling, transaction support, information services, and so on.
2. Web Container
What is a container:
A container is a service invocation specification framework that utilizes container and component technologies to build tiered, enterprise-grade applications. In the Java EE specification, the corresponding WEB Container and EJB Container, etc.
The Web container provides an environment for the application component (Jsp,servlet) in which the jsp,servlet interacts directly with the environment variables in the container, without having to pay attention to other system problems (from this point of view, the Web container should belong to the schema concept). Web containers are primarily implemented by Web servers. For example: Tomcat,weblogic,websphere and so on.
If the interface provided by the container strictly complies with the WEB application standard in the Java EE specification. We call this container the WEB container in the Java EE.
The WEB container is more of a deal with HTTP-based requests. And the EJB container is not. It is more about dealing with databases and other services.
The behavior of a container is to isolate its internal application components from the communication protocols of the outside world, thereby easing the burden on the internal application components (Implementation burden). )。 For example, the SERVLET does not care about the details of HTTP, but directly refers to the environment variables session, request, response, EJB does not care about database connection speed, various transaction control, directly by the container to complete.
3. Web server
Web servers (Web server) can handle HTTP protocols. When the WEB server receives an HTTP request, it returns an HTTP response, such as sending back an HTML page.
The WEB server can respond to requests for static pages or pictures, make page jumps (redirect), or generate a dynamic response (response) delegate (delegate) to some other program, such as CGI scripts, JSP (JavaServer pages) scripts, servlets,asp (Active server Pages) scripts, server-side JavaScript, or some other server-side technology.
The WEB server simply provides an environment that can perform server-side programs and returns (program-generated) responses without exceeding the scope of the function.
The WEB server primarily handles requests that require HTML to be sent to the browser for browsing.
4.Application Server (the application server)
By definition, as an application server, it is required that commercial logic can be exposed to (expose) client applications through various protocols, including the HTTP protocol. The application uses this business logic just as you would call an object's method or procedure (a function in a language).
5, Serverlet
Servlet (Server Applet), full name Java Servlet, without Chinese translation. is a server-side program written in Java. Its main function is to interactively browse and modify data to generate dynamic Web content. The narrow-sense servlet refers to the Java language implementation of an interface, the generalized servlet refers to any implementation of the Servlet interface class, in general, people will understand the servlet as the latter.
The Servlet runs in a Java-enabled application server. From the implementation, the servlet can respond to any type of request, but in most cases the servlet is used only to extend the HTTP protocol-based WEB server.
6. Tomcat
Tomcat server is a free open source WEB application Server, belongs to the lightweight application server, in small and medium-sized systems and concurrent access users are not widely used, is the first choice to develop and debug JSP programs. For a beginner, it can be thought that when an Apache server is configured on a single machine, it can be used to respond to requests for access to HTML pages. The tomcat part is actually an extension of the Apache server, but it runs independently, so when you run Tomcat, it actually runs separately as a separate process from Apache.
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages Technologies.
The Tomcat server is a free open source WEB application server. Because of its advanced technology, stable performance and free, it has been favored by Java enthusiasts and has been recognized by some software developers, becoming a popular WEB application server.
One, Tomcat and application server
So far, Tomcat has been considered the executor of the servlet/jsp API, as well as the so-called Servlet container. However, Tomcat does not only do this, it also provides the implementation mechanism for JNDI and JMX APIs. However, Tomcat is still not an application server because it does not provide support for most of the Java EE APIs.
Interestingly, many application servers today often use Tomcat as a container for their Servlet and JSP APIs. Because Tomcat allows developers to embed tomcat into their applications simply by adding a line of acknowledgements. Unfortunately, many commercial application servers do not comply with this rule.
For developers, choosing Tomcat is a great solution if you're looking to build Java Web applications using Servlet, JSP, JNDI, and JMX technologies, but to find support for other EE APIs, look for an application server or TOMC At as an application server assistance, will be a good solution, the third way is to find a separate Java EE API implementation, and then use them together with Tomcat. Although consolidation can bring about problems, this approach is most effective.
Ii. Tomcat vs. Web server
Tomcat is a container that provides support for Servlets and JSPs to run. Servlets and JSPs can generate dynamic Web content based on real-time needs. For WEB servers, Apache only supports static web pages, and it is powerless to support dynamic Web pages, while Tomcat can serve dynamic Web pages and support static Web pages. Although it is not as fast as the usual Web server, it is not as rich as the Web server, but Tomcat is gradually expanding to support static content. Most WEB servers are written in the underlying language, such as C, and take advantage of the features of the corresponding platform, so Tomcat execution speed written in plain Java is unlikely to be comparable to them.
In general, the large site is a combination of Tomcat and Apache, Apache is responsible for accepting all HTTP requests from the client, and then forwarding Servlets and JSP requests to Tomcat for processing. After Tomcat finishes processing, the response is passed back to Apache, and the final Apache returns the response to the client.
Web container Web server application Server