• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

General Query about Servlet  RSS feed

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks in advance.
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hany
To be very honest, I didn't get your explaination for my query.
Can you please re-elaborate?
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
MaheshS Kumbhar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ulf Dittmer
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!