You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Johnson, David" <d....@Cranfield.ac.uk> on 2003/08/14 12:23:48 UTC

Retrieving DOCUMENT_ROOT from apache using mod_jk

In my CGI programming days I often used the cgi variable called
DOCUMENT_ROOT, which apache sets to the root of the document tree. This
was very useful because we have many virtual hosts with different
document roots. I'm trying to find a method of retrieving this variable
from a servlet. I have tomcat 4.1.27 connected to Apache using mod_jk.

A couple of sources I have found suggest using
getServletContext().getRealPath("/"). However when I try this it gives
me the location of my servlet and not of the apache server's document
tree.

Does anyone know how I can retrive this information?

Many Thanks
Dave