• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Image downloads by browser

 
Ranch Hand
Posts: 354
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I have understood, first the skeleton HTML content is downloaded and then the browser asks the server for Images etc by sending request(s). But our requests are handled by a servlet. So how does the server know that it has to serve a file rather than looking into web.xml for further forwards.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this example is not your situation, you'll have to provide more details, but here is one explanation...

The page you request is:

http://www.mysite.com/servlet/catalog?page=5

First, whatever process (probably a webserver) is listening to port 80 on the www.mysite.com will look at /servlet/catalog?page=5

It sees /servlet and says "aha, I must forward that to my Tomcat instance" (or Weblogic or iplanet... whatever). When it gets there, Tomcat will says "I have a /catalog mapped to this class over here, I will send it the parameter 'page=5' and the response will be sent back to the webserver. The webserver then sends that response back to the browser.

If you are running standalone Tomcat, then Tomcat is the one to say "aha, I see /servlet and that means I am to respond with the output of the servlet mapped to /catalog after sending it 'page=5'.

When your browser gets the response, it parses the response and for every image, it will make a new request.

What saves you from going through Tomcat again and again, is that the image is usually requested from an images directory. The request would be for something very much like:

http://www.mysite.com/images/foo.gif

So the webserver gets this, and there is no /servlet in the request URI. Therefore, it will merely server the static foo.gif from the images directory.
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic