tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gopa Kumar <>
Subject RE: Accessing Env variables from tomcat servlets
Date Fri, 11 Aug 2000 16:45:49 GMT
This does not solve my problem, which is getting some module (Apache)
specific information to the servlets.  I have been using env vars for
getting this info to Perl cgi scripts. If custom env vars do not work with
tomcat, is there is an alternate way to get some module specific info to the
servlets ?


-----Original Message-----
From: Craig R. McClanahan []
Sent: Friday, August 11, 2000 10:26 AM
Subject: Re: Accessing Env variables from tomcat servlets

Gopa Kumar wrote:

> Hi,
> Does anybody know how to access env variables from tomcat servlets.  I
> an Apache module that adds a bunch of env vars into
> request_rec->subprocess_env.  They are working ok with Perl CGI.  Since I
> now trying to port some of these scripts into servlets, I need to access
> these vars from servlets.  I tried setting
> wrapper.env.copyall=true and also ApJServEnvVar but to no avail.
> req.getAttributeNames still does not return any of my env vars.
> Incidentally, I did see code for handling ApJServEnvVar in mod_jserv.c.
> I doing something wrong, or is there another way to access these variables

Most of the environment variables you are interested in are actually
properties on the request object.  For instance, the value of the
environment variable corresponds to the request.getPathInfo() method. 
Check out
the API documents on the javax.servlet.http.HttpServletRequest interface
javax.servlet.ServletRequest, which it extends) to see what information
available to you.

> thanks,
> -Gopa

Craig McClanahan

View raw message