You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2001/09/24 17:21:21 UTC
DO NOT REPLY [Bug 3790] -
getRealPath returns context path twice
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3790>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3790
getRealPath returns context path twice
craig.mcclanahan@sun.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Additional Comments From craig.mcclanahan@sun.com 2001-09-24 08:21 -------
Tomcat is behaving the way the documentation says to act. The argument you pass
to getRealPath() should be relative to the *context*, not to the *server*. The
way to get the answer you want is like this:
String relative = request.getServletPath();
if (request.getPathInfo() != null)
relative += request.getPathInfo();
String realPath = getServletContext().getRealPath(relative);
or run your application as the ROOT web-app, in which case context-relative and
server-relative paths are the same.