|
From: Chris H. <ch...@ha...> - 2003-12-04 17:36:47
|
I'd be inclined to use a Servlet initialisation parameter myself, rather than a system property. It would then go in the XML or API invoking that particular servlet, so it would remain physically adjacent to where it was used. This would also meet your desire to not have the values iterated over on every script (servlet) execution. Second point: I think Greg has been getting a bit worried by just how many settings are being carried via the system properties. Some OSs seem limited in command length (see other thread earlier today) and scripts are not nice places in which to mix release-specific and site-specific settings. I don't know what his thoughts are on an alternative. Perhaps property files or an extension to the XML / API config arrangements? Chris ----- Original Message ----- From: "Craig L. Ching" <cc...@mq...> To: <jet...@li...> Sent: Thursday, December 04, 2003 4:13 PM Subject: [Jetty-support] Specifying environment variables that should be passed to a CGI script 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=%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 ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=ick _______________________________________________ Jetty-support mailing list Jet...@li... https://lists.sourceforge.net/lists/listinfo/jetty-support |