tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject Re: Forwarding from within a Servlet
Date Tue, 29 Apr 2003 15:35:40 GMT

Jan Behrens wrote:

> getPathToRoot() basically takes the request.getHeader("referer") and extracts
> the number of "/", minus those used in the hostname and returns a string
> containing "../" for each "/" found and TIMEOUT_URL contains the complete path
> to the resource from document-root.
> The url build out of those is correct in itself, the RequestDispatcher however
> doesn't forward to the right page but instead ignores all but the pagename.

3 things --

1) if you use a logger, have you logged the value returned from 
getPathToRoot()?  Make sure you do it from the actual URL (not just a 
test URL) so you can confirm that the URL is what you expect it to be.

2) This is really just an extension of #1, that is that not every user 
agent respects the "referer" header (in other words not every browser 
will send it, esp. non-browser user agents).  Confirm that this header 
is indeed going out to your servlet.

3) You can get a resource relative to your context root by starting your 
path with "/" (in the argument to getRequestDispatcher).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message