File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes where does a servlet engine reside? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "where does a servlet engine reside?" Watch "where does a servlet engine reside?" New topic

where does a servlet engine reside?

jini jane

Joined: Nov 06, 2002
Posts: 4
Web servers are a sub-set of application servers.
Can we say all web servers are application servers with a limited functionality of handling http requests?
For a servlet to excute a servlet engine is required.Where does this servlet engine reside? in a Web server or an Application server?
jini jane

Joined: Nov 06, 2002
Posts: 4
This is a reply i got from Ravish Kumar Singh
Hi jini jane,
Its not like that I am very knowledegable, but still I will try to answer
your question.
Actually I also had the same problem in understanding the web server and app
And my understanding is:
Web Server: Web server is a server basiaclly which implements HTTP protocol
to communicate with other clients who also implements HTTP protocol for
contacting the server. Server's example which are coming to my mind is you
can think of old version of PWS(Personal web servers), in truly sense they
were web server, whose job was to listen request and send back the required
resource(most of the time plain html files), if available on server.
OK, first let us see what is URL. URL is consist of
Protocol://DomainName/resourcePath/resource Example:
Client examples are IE, netscape.. and other internet browsers.
We can also compare this with restaurant industry where waiter's job is to
take order and serve it. Customer is client who is looking for some
Now let us see application server. Application server is, if we again
consider our example is Cook in restaurant. Now customer orders for coffee,
waiter takes the order, forward it to cook, cook makes coffee give back to
waiter to server it to the customer. Now server is not aware of cook, he can
see only waiter. If customar wants to communicate with restaurant(i.e. web
application), the only way is waiter.
Now if coffee is already made by someone and available in restaurant, we
dont need cook. But customer might get cold coffee instead of hot.
I hope by now web server and app server difference is clear.
Now, a waiter cant make coffee but a cook can. Now if cook is working as
waiter also, I mean if he is taking order/request and making coffe also he
is working as both, I mean web server and app server.
Now in todays era, there is very thin line between web server and app
server, all app server(cook) are also web server(waiter).
Now let us see your second prob:
Servlet engine resides in a app server. When a request comes webserver
listens it if the request is suppose to be paased to app server it passes it
to app server. Now app server decides what to do with the request and most
of the time he has to do some computation or something. So app will invoke
servlet engine.
And as I said now days there is very thin line between web server and app
Now last but not least, even though cook is also working as waiter but its
not necessary that he will go in kitchen for all orders. Some customer might
ask water for which he does not need to go to kitchen. So though he is cook
but still at that time he is totally working as waiter, but it is a very
less price for what he is saving by not giving monthly pay to waiter.
hmmmmm... I hope you understand all this, whatever I wrote.
All the best
Ravish K Singh
[ November 27, 2002: Message edited by: jini jane ]
Kees van Oosterhout
Ranch Hand

Joined: Jul 08, 2002
Posts: 34
Jini, I'll have a burger and french fries
To clarify, an application server is NOT a subset of a webserver. The are two separate processen, each with their own responsabilties. Their implementations however can give you the impression that they are strongly coupled. For example: You add a plugin to apache to serve servlets and jsp's. But a webserver can exists without an application server. An application server can exists without a webserver (with his own build in webserver).
To explain briefly: A web server is developed for serving requests for static content. An application server is developed for serving reqeust for dynamic content.
Hope it helps....

"'ve got to ask yourself one question, Do I feel lucky?"
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
Very true .. waiter and cook are totally two different entity

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
I don't think the question, "how is a web server different from an app server?" has a clean answer, perhaps because they both share the same client and protocol, and by virtue of CGI can provide nearly identical functionality and interact with the same resources behind the server.
To me, Apache is just a web server, but if CGI is enabled, and the CGI application provides session management and a connection to a database, is Apache transformed into an application server?
I don't think so, and here's why: the CGI application has a couple of things that still keep it from being integrated into the web server. One is the fact that it is CGI, and runs as a process outside of the server. Secondly, the CGI application cannot be said to have its own "application context" -- it is differentiated from the rest of the server only by virtue of its URL.
The line gets blurred somewhat though when you introduce such things as virtual hosts and plugins like mod_perl or fast_cgi. now the application runs inside of the server process, and can be persistant in memory, with its own environment if you will. This is still not the same as an application context, but it is getting there. You can set up persistant connection pooling, and most of the things that we like to see in an application server, but the level of integration between the application and its environment is still not quite there, or is it?

When we look at most application servers, we see a program that has builtin script parsing (perhaps even using a proprietary tagging language such as in the ColdFusion server), application context management, and perhaps some centralized, builtin connection pooling. And the thing will even serve up static HTML, which may cause confusion with a regular web server.
I think the M$ IIS server, with its ASP technology is a sort of crude example of an application server, however, it gains most of the app server characteristics by virtue of its tight integration with the OS.
Modern J2EE servers are good examples of app servers, in that they allow you to set up the server, and then install the applications to be served. Each app has its own context, and is managed independently of the others, and all apps can share connection pooling and other resources. This is a far cry from the CGI-enabled Apache server that I started with, but then again, not really so very different.
Okay, so I'm as confused as ever; how about you?
[ November 27, 2002: Message edited by: Philip Shanks ]

Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
Originally posted by Philip Shanks:

Okay, so I'm as confused as ever; how about you?

same here
I think reason is same as there is very thin line between them.
But still web server is, for me, which implements HTTP protocols and app server is what, which does some job for any http request on behalf of web server to provode some resource to client(Dynamic OR static).
I agree. Here's the link:
subject: where does a servlet engine reside?
jQuery in Action, 3rd edition