Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Retrieving DOCUMENT_ROOT from apache using mod_jk

Johnson, David

2003-08-14


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

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.