Franz-Josef Herpers wrote:
Hi,
I've a problem when using ServletContext#getRealPath() with Tomcat 5.5.9.
My web application resides under the name "tool" in the webapps
directory. When I call
servletContext.getRealPath(request.getContextPath() I get the real
path but always with the context path added at the end. That means a
path like C:\path\to\tomcat\webapps\tool\tool.
Is there any explanation for this behaviour? Or am I doing something
wrong?
Thanks for any hints in advance
Regards
Franz
the getRealPath method simply returns a path inside the webapp's
directory. eg. you can do getRealPath("images/someimg.jpg") and get the
actual filesystem path for that file, so you can access it using
java.io.File and do something with it. getRealPath("/") should give you
the webapp directory itself.
note that you probably should not use this method, if you ever want to
be able to run your webapp directly from a .war file.
Edmund
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]