|
From: Craig L. C. <cc...@mq...> - 2003-12-04 16:13:06
|
To resolve the issue I'm having with my perl script (see the recent = thread about using gethostbyname in a CGI), I'm going to add a way to = allow a user to alter the environment that the CGI servlet creates when = it executes a CGI script. My plan is to search the system properties = (via System.getProperties()) for properties that are named using a = specific convention. For instance, I was thinking of allowing the user = to specify the variable they want passed like this: java -Djetty.cgi-env.SYSTEMROOT=3D%SYSTEMROOT% -jar start.jar Then I would modify org/mortbay/servlet/CGI.java to look for system = properties that have the "jetty.cgi-env" prefix and add the last part of = the prefix (e.g. SYSTEMROOT) as an environment variable to the = environment that is created by = "Runtime.getRuntime().exec(execCmd, env.getEnvArray())". Does this sound reasonable? I'll be happy to send a patch to the list = as I'd like to see this implemented as a standard feature of Jetty. = Also, I'd like to cache these values somewhere so that I don't have to = iterate over the list every time a script is executed. Would it be = appropriate to do that in the constructor for CGI? Or would somewhere = else be more appropriate? I'm not 100% comfortable with the code yet = (just started looking at it on Monday ;-) ), so any pointers would be = much appreciated. Cheers, Craig -- Craig L. Ching Chief Product Architect IBM Certified Specialist, MQSeries IBM Certified Developer, MQSeries MQSoftware, Inc. (952) 345-8720 www.mqsoftware.com=20 =20 |