Are you running out of the ROOT directory? If so, then that is correct. The real path of "/" is relative to your context so it would give you the absolute path to the root of your context, whichever context that is....that is if you are running from a directory and not directly from a .war file, in which case getRealPath() would return "null".


Jake

At 09:56 PM 3/31/2003 -0800, you wrote:
Hi,

I have Apache and Tomcat hooked-up using the mod_jk connector. I was
wondering if Tomcat (or a Java Servlet running on Tomcat) is able to
read the DocumentRoot of the Apache web server. I used the following
code in my Servlet:

String doc_root = getServletContext().getRealPath("/");
out.println("doc_root = " + doc_root);

but doc_root comes out as the Tomcat ROOT directory path, and not the
Apache DocumentRoot path. Is what I am looking for even possible? I know
there are ways, but most of these involve hard-coding the path in
Tomcat's config files (virtual host definitions and stuff like that).  I
am trying to avoid hard-coding the path anywhere in Tomcat.

Thanks,

Steve Cromer
[EMAIL PROTECTED]
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to