Hi Everyone -
I have a requirement to allow for URLs on a site of the format
www.site.com/target where 'target' is not a real directory or servlet,
but redirects to another page on the site.
To handle this, I have developed a ServletFilter which takes the
'target' off the URL and attempts to do a server side forward to a
servlet using the RequestDispatcher. This is working for
www.site.com/target. I can get the RequestDispatcher from either the
ServletRequest or the ServletContext and redirect to any target servlet
with forward().
The problem arises where I try to handle www.site.com/target/ (note the
trailing slash). In this case, the RequestDispatcher forwards to the
target correctly HOWEVER, all subsequent HTTP GETs for images, css, etc,
are being attempted on the wrong directory, /target/. This seems to be
because the ServletRequest doesn't seem to adjust its path elements
accordingly. For instance, if /target/ is supposed to redirect to
target.jsp using forward("/target.jsp") the requests look like:
www.site.com/target.jsp
www.site.com/target/image.gif
www.site.com/target/style.css
Of course, /target was never a real directory to begin with :)
Now, According to the API doc for RequestDispatcher:
"For a RequestDispatcher obtained via getRequestDispatcher(), the
ServletRequest object has its path elements and parameters adjusted to
match the path of the target resource. "
Does anyone have any experience with this issue? Is this a bug? Is
there a workaround?
Thanks so much,
Alan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]