This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am new learner of Servlets and JSP.
I have one query.
If a client request comes in for static content say html page, then does web server application like apache directly fetches the static content without handing request to web container like tomcat?
Because till now what I learned is that if a request is for servlet then the request is handed over to container(tomcat)
Let me know if I am correct or wrong.
I guess your understanding is correct, In case Tomcat doesn't run in standalone mode. The web server will process HTML files that are stored in the file system and Servlet requests are passed to the Web container.
Joined: Sep 24, 2009
To be very honest, I didn't get your explaination for my query.
Can you please re-elaborate?
You need to understand that Tomcat is both a web server and a servlet container. The web server part is perfectly capable of serving static content like HTML and images. (This is what Hany calles "standalone mode".) Sometimes that part is handled by a dedicated web server (like Apache httpd), though, in which case Tomcat is used only for its servlet container functionality.
Joined: Jun 21, 2008
Not sure, but I think there are different modes in which you can run Tomcat.
You can run it in stand alone mode in such case the Servlet container is also a web server and handles both requests HTML pages and Servlet requests.
You can also run tomcat as a add-on to an existing web server (e.g. Apache), in this case only if the request is a Servlet request, the Servlet container will take control.
Joined: Sep 24, 2009
One more question to this.
As per the discussion above, static content request are handled by web server application like apache, but how does it(apache) map the URL to the actual static resource, because mapping URL to resource is done by the container. So is it that web server application also has the same capability to map URL's to resource as container does?