File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes What Are the Differences Between HTTP Server and Servlet Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "What Are the Differences Between HTTP Server and Servlet Container" Watch "What Are the Differences Between HTTP Server and Servlet Container" New topic

What Are the Differences Between HTTP Server and Servlet Container

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
What are the differences between a HTTP Server and a Servlet Container? Tomcat is a Servlet container. Apache is a web server. What is a HTTP Server?
Geeta Ramasami
Ranch Hand

Joined: Mar 05, 2003
Posts: 72
HttpServer is meant for receiving the user request and identifying the resource to be processed and sending the response to the client.
Whereas servlet container would be responsible for compiling the servlet using the javac and then executing the class file. The output of the servlet excution would be routed to the HttpServer which would send it as a response to the client.
Hope this helps.
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi all,
Is HTTP Server part of Web server?

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

"Web Server" is not a hugely helpful name. Web pages are served using HTTP, so a Web Server is analagous to an Http Server. Its less confusing if you call "Apache" (often refered to as a web server) by its full name: Apache Http Server.
[ January 25, 2005: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Note that Tomcat's "default" servlet acts as a plain HTTP server which is why a typical Tomcat installation serves plain web pages and resources such as image files as well as directing selected requests to servlets and servlets created from JSP. Unfortunately there is room for confusion because the Apache Software Foundation is the home of both the Apache web server and the Tomcat servlet engine/web server.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Below is the answer I got from another forum. Please comment:

HTTP is the Hypertext Transport Protocol. Both Apache and Tomcat will accept HTTP requests.

The difference is that Apache is JUST an HTTP server. It serves up static HTML pages.

Tomcat has an HTTP listener inside it, but in addition to that it has a servlet/JSP engine. It can serve up both static and dynamic HTML pages.

You can use Tomcat without Apache.

Apache cannot handle servlet/JSP requests without having a servlet/JSP engine bolted on top of it.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

That's accurate.
[ January 26, 2005: Message edited by: Paul Sturrock ]
Hareesh Ram Chanchali
Ranch Hand

Joined: Jan 31, 2005
Posts: 110
Tomcat is the official reference implementation of the Java Servlet and JavaServer Pages technologies. Developed under the Apache license in an open and participatory environment.
Apache has set of projects in which HTTP (web) Server and jakarta are two names of the projects. jakarta deals with java-related efforts.
Under jakarta, we have Tomcat,Struts,Ant,Log4J and other ....

Tomcat's purpose is to provide standards-compliant support for servlets and JSP pages. The purpose of servlets and JSP pages is to generate web content such as HTML files or GIF files on demand using changing data. Web content that is generated on demand is said to be dynamic. On the other hand, web content that never changes and is served up as-is is called static.

While Tomcat is capable of serving both dynamic and static content, it is not as fast or feature-rich as the Apache web server with regard to static content. While it would be possible for Tomcat to be extended to support the same features that Apache does for serving up static content, it would take a great deal of time;

Apache has been under development for many years. Also, because Apache is
written entirely in C and takes advantage of platform-specific features, it is unlikely that Tomcat, a 100% Java application, could ever perform well as Apache.

The earliest versions of Tomcat included a connector that enabled Tomcat and Apache to work together. In this arrangement, Apache receives all of the HTTP requests made to the web application. Apache then recognizes which requests are intended for servlets/JSP pages, and passes these requests to Tomcat.Tomcat fulfils the request and passes the response back to Apache, which then returns the response to the requestor.

However, as mentioned above, Apache will most likely always have superior performance and options when it comes to serving up static content
and communicating with clients via HTTP, and, for this reason, anyone who is using Tomcat for hightraffic web applications may want to consider using Apache and Tomcat together.

Hareesh Ram Chanchali
SCJP 5.0, IBM Certified Solution Designer
I agree. Here's the link:
subject: What Are the Differences Between HTTP Server and Servlet Container
It's not a secret anymore!