Richard Yumul wrote:

> Can somebody please tell me how to access the server enviroment variables?  For
> example, how do you access variables like DOCUMENT_ROOT, etc.?
>
> Thanks,
> Rich Yumul
>

Most of the "interesting" CGI-related environment variables are directly
translated into methods in the HttpServletRequest.  For example, the
PATH_INFO value is returned by getPathInfo(), PATH_TRANSLATED by
getPathTranslated(), and so on.  The details are in the Javadoc API descriptions
of each method.

The particular case of DOCUMENT_ROOT is interesting, because it is an Apache
extension, not a standard CGI variable (and thus it is not visible through the
standard servlet API).  Apache JServ does know about this value, however, and uses
it as the basis for paths calculated by the getRealPath() call.

Craig McClanahan

PS:  I am about to add this question and answer to the FAQ-O-MATIC at
http://java.apache.org -- a very useful place to look up answers to previously
asked questions.





----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to