Just an idea: Extend the CGIServlet (MyCGIServlet) and override the setCGIEnvironment method (it is protected, so you could call it and then add your variables which you could read from a properties file or something). Then modify the web.xml file found in Tomcat's conf directory to invoke your CGI servlet by changing the servlet-class attribute of the cgi servlet element (<servlet-class>com.mycomp.servlets.MyCGIServlet</servlet-class>). I don't see why this wouldn't work.
Jim -----Original Message----- From: Tim Funk [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 1:38 PM To: Tomcat Users List Subject: Re: CGI environment vars O sweet sweet source code for CGIServlet.java .... http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/catalina/src/share/org/ apache/catalina/servlets/CGIServlet.java?rev=1.11&content-type=text/vnd.view cvs-markup Heres the deal: Look for the method: protected boolean setCGIEnvironment(HttpServletRequest req) and you'll see the environment be created. This environment is passed to the script. So you are SOL I think. But there is hope ... write a wrapper shell script around your real CGI script like this and you might luck out: ---------------------------------- #!/bin/sh export CRAP=mycrap . /pull/in/some/file exec real_cgi_name ---------------------------------- -Tim Madere, Colin wrote: > Yep.. tried both the sh and csh syntax, no luck. > > >>-----Original Message----- >>From: Tim Funk [SMTP:[EMAIL PROTECTED]] >>Sent: Wednesday, February 05, 2003 1:28 PM >>To: Tomcat Users List >>Subject: Re: CGI environment vars >> >>I haven;t seen this discussed yet, you are exporting your variables in >>setenv.sh AND setenv.sh is located in $CATALINA_HOME/bin? >> >>Example: >>-------- >>export WACKY=very >> >>or >> >>ANSWER=42 >>export ANSWER >>-------- >> >>-Tim >> >> >>Madere, Colin wrote: >> >>>Already tried this and it didn't work. Both in the setenv.sh (checked >> >>for >> >>>and read by catalina.sh) and startup.sh. It seems that's for the Tomcat >>>running environment but is not transferred to the CGIServlet's exec >>>environment. >>> >>> >>> >>>>-----Original Message----- >>>>From: Sean Dockery [SMTP:[EMAIL PROTECTED]] >>>>Sent: Wednesday, February 05, 2003 11:44 AM >>>>To: Tomcat Users List >>>>Subject: RE: CGI environment vars >>>> >>>>What about setting the variable yourself in the catalina.sh script? If >>>>that doesn't work, make sure that the variable is exported (so that it >>>>remains in the super shell when the sub shell exits). Example: >>>> >>>>LD_LIBRARY_PATH=.../.../ld.so; export LD_LIBRARY_PATH; >>>> >>>>At 11:23 2003-02-05 -0600, you wrote: >>>> >>>> >>>>>no no.. I'm using the CGI facility in Tomcat (see Tomcat docs). >> >>There's >> >>>>a >>>> >>>> >>>>>servlet set up to handle it already, and the CGI is getting executed >> >>but >> >>>>the >>>> >>>> >>>>>logs show that it's getting an error loading ld.so because it can't >> >>find >> >>>>it >>>> >>>> >>>>>(which is also the case when trying to run it in a shell without having >>>>>LD_LIBRARY_PATH set appropriately). >>>>> >>>>> >>>>> >>>>>>-----Original Message----- >>>>>>From: Filip Hanik [SMTP:[EMAIL PROTECTED]] >>>>>>Sent: Wednesday, February 05, 2003 11:21 AM >>>>>>To: Tomcat Users List >>>>>>Subject: RE: CGI environment vars >>>>>> >>>>>>how about you do it yourself, I assume that you launch your CGI script >>>>>>using Runtime.exec >>>>>>in that case, use the method that >>>>>> >>>>>>http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Runtime.html >>>>>> >>>>>>take a look at >>>>>> >>>>>>Runtime.exec(java.lang.String,java.lang.String[],java.io.File) >>>>>> >>>>>>-----Original Message----- >>>>>>From: Madere, Colin [mailto:[EMAIL PROTECTED]] >>>>>>Sent: Wednesday, February 05, 2003 8:44 AM >>>>>>To: [EMAIL PROTECTED] >>>>>>Subject: CGI environment vars >>>>>> >>>>>> >>>>>>Tomcat 4.1.18 : UMN Mapserver CGI >>>>>> >>>>>>I have a CGI which needs to see the "LD_LIBRARY_PATH" to get to shared >>>>>>libraries to run. However, I can't seem to get whatever shell that >>>> >>>>Tomcat >>>> >>>> >>>>>>uses to run CGIs seeded with that variable. >>>>>> >>>>>>I tried putting it in the "setenv.sh" which is checked for and used in >>>>>>catalina.sh, but that doesn't seem to have any effect on CGIs. >>>>>> >>>>>>Anyone have an idea? >>>>>> >>>>>>Colin >>>>>> >>>>>> >>>>>>--------------------------------------------------------------------- >>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>For additional commands, e-mail: [EMAIL PROTECTED] >>>>>> >>>>>> >>>>>>--------------------------------------------------------------------- >>>>>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>>--------------------------------------------------------------------- >>>>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>>Sean Dockery >>>>[EMAIL PROTECTED] >>>>Certified Java Web Component Developer >>>>Certified Delphi Programmer >>>>SBD Consultants >>>>http://www.sbdconsultants.com >>>> >>>> >>>> >>>>--------------------------------------------------------------------- >>>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>>--------------------------------------------------------------------- >>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
