Tom Eugelink wrote:
> I tried using environment variables because the webserver that hosts my
> website doesn't feature servlets yet. But I have not succeeded. It seems
> that by deprecating the getenv() calls and suggesting property files, SUN
> wants to prevent the usage of environment variables completely: either type
> it in a property file or specify it as commandline parameters.
>
> As I said: I have not found a solution.
>
One time (long ago and far away ...) I had to write a Java app that was accessible
via CGI, somewhat similar to what you're doing. What I ended up doing was writing
a little C program that constructed a command line to execute my Java app,
converting all environment variables it found into system property settings.
So, for example, if you needed to pass CONTENT_LENGTH and CONTENT_TYPE, they got
converted by my little C wrapper into a command line like:
java -DCONTENT_LENGTH=xxx -DCONTENT_TYPE=yyy .... com.mycompany.MyApplication
That way, my Java program could access these values with System.getProperty(). I'm
sure someone savvy with shell scripts would be able to do this without a program,
but for me C was easier.
>
> Tom
>
Craig McClanahan
PS: Of course, even if Java provided access to environment variables easily, they
would be of no use to servlets -- environment variables are global to the
application, where the things servlet cares about are local to each request. This
only works for CGI because the program is executed individually for each request.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets