Re: set environment variables in tomcat

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Kim Goldov wrote:
> Thanks everyone. Here is what I ended up with.
> 
> In my PerlHeaderParserHandler:
> 
>     $r->subprocess_env(AA_MYVAR => 'myvalue');
>     $r->subprocess_env();
> 
> In jk.conf:
> 
>     JkEnvVar      AA_MYVAR
> 
> In Tomcat:
> 
>       out.println("AA_MYVAR is: " + request.getAttribute("AA_MYVAR") );
> 

Right.
But don't forget that this is very Apache/mod_jk/Tomcat specific.
A more generic way of doing this would be to set an additional header in the request at 
the Apache level, and get this header at the Tomcat level with request.getHeader().
That would work with any proxying scheme between Apache and a back-end servlet engine 
(mod_jk, but also mod_proxy_http and mod_proxy_ajp).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.