File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Diffs bw. web server and web container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Diffs bw. web server and web container" Watch "Diffs bw. web server and web container" New topic

Diffs bw. web server and web container

Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi all,

I'd like to clear something in my brain (yeh, it is already too cloudy ). I'd greatly appreciate your help.

Web server - serves only static content (eg, static html page)

Web container - serves only dynamic content (eg, dynamically generated html page)

When a web server receives a request that must be serviced by a servlet it passes control to a web container. Container does its thing, gives the response back to the container, which in turn will convert it into HTTP response.

Therefore, we can always draw a line between web server and web container functionalities.

All web containers will need to have a basic web server functionality provided that they can be used on their own. So, will it be correct to say that a web container has two logical parts: one responsible for web server functionality (eg, converting response to HTTP response and then sending to the client), another for web container functionality (eg, creating HTTPServletRequest and HTTPServletResponse java objects)?

Thanks again for your answers.

P.S. I'd like to thank Cathy and Co. for the excellent book.

Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
Greetings from Hogwarts,

You got it right. I think now a days a web container also usually implicitly means a web server supported web container.

Teh book says tomcat is only a webcontainer but can also be configured to be a web server also. But usually tomcat runs as webcontainer in conjunction with apache as the web server..

basically I am merely parrotting what the book says

Kathy Sierra
Cowgirl and Author

Joined: Oct 10, 2002
Posts: 1589
Yep -- y'all are both right about this (good explanation Alex!)

The only thing I wanted to add is that there's another player that can be in the picture: a full J2EE app server.

A J2EE app *server* has:

* A web *server* (HTTP server capabilities)
* A web *Container* (like Tomcat)
* An EJB *Conatiner* (not really meaningful to have standalone EJB Containers any longer; they are virtually always part of a J2EE server these days)

(Plus a J2EE server includes other things including a JNDI implementation, something that supports JMS, etc.)

So, even though the J2EE spec includes the specs for the web Container, you can have a J2EE-compliant web Container (like Tomcat) which is *not* itself a J2EE server.

Hope that makes sense... I'm still waking up

Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Thanks a lot, Brian and Kathy. It is all clear now, all clouds are gone.

P.S. Kathy, I am sorry for misspelling your name in my original message.
[ October 04, 2004: Message edited by: Alex Sharkoff ]
I agree. Here's the link:
subject: Diffs bw. web server and web container
It's not a secret anymore!