Hi.

I believe that the problem you are having has nothing to do with Tomcat per se, and everything to do with how absolute and relative link references work in the WWW (or in HTTP/HTML) in general.

You need a tutorial on that subject, and to always consider what happens *from the browser's point of view* when it sees a link to a resource, in a page which it just loaded from a server.

Here is a summary introduction :

a) the browser retrieves a page from the URL "http://somehost.cpy.com/some/path/document.html";.
That is now the "current page".

b) in this document, there is a link to another resource to be loaded on-the-fly, like an <img> tag, or a <style> or a <script> tag, and in this link is a URL, from which this resource can be retrieved. The browser will attempt to retrieve this resource (image, stylesheet, javascript,) using this URL.

c) if the link URL is not "complete" (meaning : consisting of the whole combination of protocol, host, and path, like "http://somehost.cpy.com/some/path/basic.css";), then the browser follows some strict rules to "complete" this URL.

For example, if the link's URL was a *relative* URL like "styles/basic.css", then the browser starts from the URL of the current page (in this case "http://somehost.cpy.com/some/path/document.html";), removes the last component (document.html), and appends the *relative* URL to that, giving in this case :
"http://somehost.cpy.com/some/path/styles/basic.css";.
Then it tries to retrieve the resource at that address.

If the link's URL is *absolute*, like "/styles/basic.css" (the starting "/" makes all the difference), then the browser starts from the URL of the current page (in this case "http://somehost.cpy.com/some/path/document.html";), removes the entire path part (/some/path/document.html), and appends the link URL to that, giving in this case :
"http://somehost.cpy.com/styles/basic.css";.
Then it tries to retrieve the resource at that address.

The above logic is recursive, in the sense that if your browser retrieves a page and finds links in it, it will apply the above logic to retrieve these other elements. Then within the elements retrieved, if there are further links to other things, it will again apply this logic to retrieve them. The "base" for each link evaluation is always the URL under which it retrieve the container of the link.

So now you have some mental gymnastic to do : retrieve your top page in your browser, look at its source, figure out how the browser (according to the above logic) fetches the embedded resources (like the stylesheet); then recursively, from the stylesheet, how it interprets the links in the stylesheet to retrieve the images.
(Using a browser plugin like HttpFox (for Firefox) or Fiddler2 (for IE) also 
helps.)
Then fix your pages and other resources, so that they present the links to the browser correctly.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to