Question

I've been using Tomcat and Jetty for quite some time now. From what I know. an application server(Servlet Container) is a container for your servlets. while the http server handles Http request and responses. but all the time I feel abstracted how these two works.

Can someone give me a high level overview of how Http Server and Application Server works? because I was reading . Grizzly and it is a NIO Server. so is it an HTTP Server? or an Application Server?

Was it helpful?

Solution

HTTP server is a component mainly concerned with handling of HTTP requests and providing HTTP responses to a client. Of course, there are other functions of an HTTP server, e.g. request forwarding, error handling and so on, but for the higher-level view it's enough to understand that an HTTP server implements the request/response mechanism. It is not tied to any programming language implementation.

Servlet container is a component that implements the Servlet specification of Java. Servlets are mainly implemented using the Java language. They are like HTTP servers in that they handle requests and responses (note that these requests and responses are higher abstractions compared to HTTP requests and responses), filters them, chain them and so on.

In most cases, servlet containers are placed behind an HTTP server. The HTTP server forwards the HTTP requests (depending on some URL mapping rules) to the servlet containers. One of the implementation of the highly-abstracted request/response specification in servlets is the HTTP request/response. In this way, an HTTP server and a servlet container can work together in serving HTTP conversations for e.g. dynamic web pages.

Application server is a more complex component (usually, it encapsulates both an HTTP server and a servlet container (if it is a Java-oriented application server)). Such a component provides modules that implement some given specifications, e.g. Java EE specification implemented by JBoss Applciation Server / WildFly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top