sendRedirect, stylesheets and relative URL's

C

Chris Riesbeck

When a link to an external stylesheet is redirected
by a servlet, shouldn't relative url's inside it
be resolved against the new location?

I have a servlet that calculates the locations of certain
files in a webapp, e.g.,

<frameset ...>
<frame src="/myservlet?get=foo.html">

myservlet figures out what directory in the webapp
has foo.html and finishes with a

response.redirect(location + file)

Relative URL's in foo.html work as I expect -- they
look for files relative to the redirected location
of foo.html.

But when I use the servlet to locate a stylesheet, e.g.,

<link rel="stylesheet" type="text/css"
href="/myservlet?get=foo.css">

and foo.css has a url() in it, e.g.,

body { background: url(../images/bkgd.gif) }

the image is not found. The rest of the stylesheet
is picked up, but not the image. The image is picked
up if I replace the relative url with a full path,
or use the servlet to calculate the location, but
both approaches are much clumsier than a simple
relative URL.

This happens in IE 6, Mozilla 1.1 and Opera 7, using
Tomcat 4.1.

Is there a bug with Tomcat, my browsers, or,
more likely, my brain?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top