Overnuts
Overnuts

Reputation: 803

Getting value of a apache's env var in servlet runtime

I'm busy with apache2 with modJK mapping tomcat webapp.

Webapp should be accessed by many virtualhost servernames / serveraliases. like

serverName a.domain.com 
serverAlias aa.domain.com
serverAlias aaa.domain.com

another vhost file:

serverName b.domain.com

every server names beginning by "a" should display the same thing

so doing a setEnv SERVER_A in may config file should be a good way, but I can't remenber how to get this environment var from the servlet code.

getcontext ? getconfig ?

Upvotes: 0

Views: 124

Answers (1)

JB Nizet
JB Nizet

Reputation: 691715

If you want to get the value of an environment variable from a Java program, you must use System.getenv(). It has nothing to do with the servlet API, and is of course global to the JVM.

Upvotes: 1

Related Questions