You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeff Brown <je...@citrix.com> on 2001/05/30 22:34:15 UTC

Tomcat incorrectly reporting results of request.getRealPath()...

Here's the issue:

I'm running Tomcat 3.2.2, stand-alone, on Redhat 7.1 with JDK1.3.1.  I have
<ContextInterceptor className="org.apache.tomcat.context.AutoSetup" />
commented out (so it doesn't add my context twice), and I have the following
Context manually defined:

<Context path="/testDir"
	docBase="/usr/local/tomcat/webapps/testDir"
	crossContext="false"
	debug="0"
	reloadable="true" >
</Context>

...and all of my JSP files reside under
"/usr/local/tomcat/webapps/testDir/testApps".  I don't have any problems
browsing to the pages, or with the JSP execution itself, but the following
code:

<%
String CurrentPath = request.getRealPath(request.getRequestURI());
System.out.println("CurrentPath=" + CurrentPath);
%>

...produces the following output:

CurrentPath=/usr/local/tomcat/webapps/testDir/testDir/testApps/test.jsp

I have other code that relies on the CurrentPath being correct, and as you
can see, this is not correct.  For some reason, Tomcat is sticking my
Context in the middle of the Real Path.  Does anyone have any idea why its
doing this and if not, is there a workaround?  Thanks...
___
jb